home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / terms / kermit / b / ikcutl.asm < prev    next >
Encoding:
Assembly Source File  |  1992-09-29  |  148.9 KB  |  1,883 lines

  1. *COPY                                                 IKCUTL            05000000
  2.          CHECKVER IKCUTL,4.2                                   @SC90072 05000500
  3.          TITLE 'CWDSET/DSPACE Routines - set/show working directory'    05001000
  4. * Set new 'working directory', i.e., filemode letter                    05002000
  5. * Entry: SCANPTR string has option                                      05003000
  6. * Exit: R15=0 if ok, R15=1 if error or help needed. ERRNUM unchanged.   05004000
  7. CWDSET   ENTER                                                 @SC86164 05005000
  8. *  CMS filespec parts                                          @SC86295 05006000
  9. FN       EQU   FILNAM,8                                        @SC86295 05007000
  10. FT       EQU   FN+8,8                                          @SC86295 05008000
  11. FM       EQU   FT+8,2                                          @SC86295 05009000
  12. *                                                                       05010000
  13. IFIFM    EQU   IFILE+24,2                                      @SC90037 05013000
  14. *                                                                       05014000
  15. JFN      EQU   JFNAM,8       Foreign FN for SEND               @SC86295 05015000
  16. JFT      EQU   JFN+8,8       Foreign FT for SEND               @SC86295 05016000
  17. *                                                                       05017000
  18.          NTOKN N=CWDERR,H=CWDERR                               @SC86164 05018000
  19.          LTR   7,7           Length of token                   @SC86164 05019000
  20.          BNZ   CWDERR        >1                                @SC86164 05020000
  21.          TR    0(1,6),UPCASE                                   @SC87034 05021000
  22.          MVC   IFIFM(1),0(6) Copy mode letter                  @SC90037 05022000
  23.        NXTFSET IFILE,CWD,E=CWDERR                              @SC86295 05023000
  24.          MVC   DEST(1),IFIFM Save new mode                     @SC90037 05024000
  25.          B     RTRN0                                           @SC86295 05025000
  26. CWDERR   PTEXT 'Must be valid CMS mode letter'                 @SC86295 05026000
  27.          B     SUBERR                                          @SC86295 05027000
  28. *                                                                       05028000
  29. *        DSPACE Routine - display available disk space         @SC86164 05029000
  30. *                                                                       05030000
  31. * Show space in 'working directory' or other minidisk                   05031000
  32. * Entry: SCANPTR string has option (none => working directory)          05032000
  33. * Exit: R15=0 if ok, R15=1 if error or help needed. ERRNUM unchanged    05033000
  34. DSPACE   ENTER ALT                                             @SC86164 05034000
  35.          MVC   QDISK+16(1),DEST Default filemode               @SC86164 05035000
  36.          NTOKN N=DSPACEX                                       @SC86164 05036000
  37.          TR    0(1,6),UPCASE                                   @SC87034 05037000
  38.          MVC   QDISK+16(1),0(6)                                @SC86164 05038000
  39. DSPACEX  HOST  QDISK,E=RTRN1                                   @SC86295 05039000
  40.          B     RTRN0                                           @SC86295 05040000
  41.          LOCALS ,                                              @SC86295 05041000
  42.          EXIT  ,                                               @SC86295 05042000
  43.          TITLE 'FSPEC Routine - extract filespec from scan string'      05043000
  44. *                                                                       05044000
  45. * Entry: R1->name field, R0=flags selecting operation (see below)       05045000
  46. *        For parse operations, SCANPTR defines the input string.        05046000
  47. *        For getting foreign or display filespec, R7->output buffer     05047000
  48. * Exit: if not FFNEW, then R15=0 if ok, 1 if ?, 2 if bad.               05048000
  49. *        For R15=1 or 2 R3,R4 give message.  ERRNUM may be leftover.    05049000
  50. *                                                                       05050000
  51. *                                 Flags:                  Notes:        05051000
  52. *   Tasks:               FFRCF FFSND FFGET FFNEW                        05052000
  53. * Parse RECV               X                     set ROVR properly      05053000
  54. * Parse SEND 1st                 X                                      05054000
  55. * Parse SEND 2nd           X     X                                      05055000
  56. * Parse GET 1st                        X                                05056000
  57. * Parse GET 2nd            X           X         set ROVR properly      05057000
  58. * Parse F-packet   (FFHDR) X     X     X                                05058000
  59. * Parse for Generic(FFUTL)       X     X         FFWLD: allow partial   05059000
  60. * Parse TAKE                                                            05060000
  61. *                                                                       05061000
  62. * Get unique name                            X     R15: 0=>ok, 1=>bad   05062000
  63. * Interactive name check               X     X     R15: 0=>ok, 1=>bad   05063000
  64. * Get foreign name (FFENC) X                 X     R15->end of string   05064000
  65. * Get display form (FFDSP)       X           X     R15->end of string   05065000
  66. *                                                                       05066000
  67. FSPEC    ENTER                                                 @SC86295 05067000
  68.          STC   0,FSPFLG                                        @SC86295 05068000
  69.          LR    5,0                                             @SC88049 05068200
  70.          SRL   5,4           Convert flags to index            @SC88049 05068400
  71.          AR    5,5                                             @SC88049 05068600
  72.          LR    0,1           Copy ptr to filespec              @SC86295 05069000
  73.          TM    FSPFLG,FFNEW                                    @SC86295 05070000
  74.          BO    FSPWRN                                          @SC86295 05071000
  75.          XC    0(18,1),0(1)  Clear filespec                    @SC86295 05072000
  76.          MVC   FSPBAD(16),=C'Invalid filename'                 @SC86295 05073000
  77.          PTEXT FSPBAD,16     Standard msg form                 @SC86295 05074000
  78.          MVI   ERRNUM,ERRFNE Assume bad file name              @SC86158 05075000
  79.          MVC   16(2,1),DEST  Default FM                        @SC86295 05076000
  80.          LH    5,FSP0(5)     Get dispatch adr                  @SC88049 05077000
  81.          B     FSP0(5)       Go to proper handler              @SC88049 05077600
  82. *                TAKE        GET 1st    SEND 1st    Generic    @SC88049 05078200
  83. FSP0    DC AL2(FSPTAK-FSP0,FSPSN2-FSP0,FSPSND-FSP0,FSPUTL-FSP0) SC88049 05078800
  84. *               RECEIVE     GET 2nd    SEND 2nd    F-packet    @SC88049 05079400
  85.         DC AL2(FSPRC-FSP0,FSPRC-FSP0,FSPSN2-FSP0,FSPHD-FSP0)   @SC88049 05080000
  86. FSPUTL   TM    FSPFLG,FFWLD  Utility: default to all files?    @SC88049 05080600
  87.          BZ    FSPASC        No                                @SC86295 05082000
  88.          MVC   0(8,1),ASTER  Yes                               @SC86295 05083000
  89.          MVC   8(8,1),ASTER                                    @SC86295 05084000
  90. FSPASC   TM    FL2,SRV       Server mode?                      @SC86295 05085000
  91.          BZ    FSPCPY        No, don't need to convert         @SC86295 05086000
  92.          ICM   15,15,LEN     Get length                        @SC86295 05087000
  93.          BZ    FSPCPY                                          @SC86295 05088000
  94.          BCTR  15,0          Correct for EX                    @SC86158 05089000
  95.          L     5,ADR         Get string ptr                    @SC89215 05090000
  96.          EX    15,FSPTRAE    Change to EBCDIC                  @SC89215 05091000
  97.          EX    15,FSPTRUP    Upcase and dot to space           @SC89215 05092000
  98.          B     FSPCPY                                          @SC86295 05095000
  99. FSPTRAE  TR    0(,5),ATOED                                     @SC89301 05096000
  100. FSPTRUP  TR    0(,5),FSPUPDOT                                  @SC89215 05097000
  101. FSPRC    NI    FL1,255-ROVR  Setup for RECEIVE                 @SC86295 05100000
  102.          NI    FL4,255-NMOK-NMCHNG  Collision not checked yet  @SC90033 05101000
  103.          MVI   0(1),C'$'     Default FN                        @SC86295 05102000
  104.          MVC   UFM,DEST      Default FM, can change by = = x   @SC86295 05103000
  105.          B     FSPCPY                                          @SC86295 05104000
  106. FSPHD    MVC   0(8,1),=CL8'$' Default fn                       @SC86295 05105000
  107.          MVC   8(8,1),0(1)   Default ft                        @SC86295 05106000
  108.          MVC   16(2,1),UFM   Default fm                        @SC86295 05107000
  109.          L     2,ADR                                           @SC86295 05108000
  110.          TR    0(256,2),FSPTAB  Make valid fn chars            @SC86295 05109000
  111.          B     FSPCPY                                          @SC86295 05110000
  112. FSPSND   TM    FL5,SALL                                        @SC88049 05113000
  113.          BZ    *+10                                            @SC86295 05114000
  114.          MVC   16(2,1),ASTER Default FM for SEND               @SC86295 05115000
  115.          B     FSPASC                                          @SC86295 05116000
  116. FSPSN2   MVI   1(1),C'='     Foreign file name is same         @SC86295 05117000
  117.          MVI   9(1),C'='                                       @SC86295 05118000
  118.          CTOKN NODOT,H=FSP2H,N=RTRN0                           @SC89097 05119000
  119.          LA    1,L'JFNAM                                       @SC86295 05120000
  120.          CLM   7,3,*-2       Does it fit?                      @SC86224 05121000
  121.          BNH   *+6           Yes                               @SC86224 05122000
  122.          LR    7,1           Use what we can                   @SC86224 05123000
  123.          LR    3,0                                             @SC86295 05124000
  124.          STC   7,0(3)        Save length                       @SC86224 05125000
  125.          LA    0,1(3)                                          @SC86295 05126000
  126.          MVCL  0,6           Get fn, at least                  @SC86224 05127000
  127.          MVI   TRTBL+C'.',2  See if valid CMS token            @SC86224 05128000
  128.          MVI   TRTBL+C'/',2                                    @SC86224 05129000
  129.          SR    2,2                                             @SC86224 05130000
  130.          TRT   1(9,3),TRTBL                                    @SC86295 05131000
  131.          MVI   TRTBL+C'.',0                                    @SC86224 05132000
  132.          MVI   TRTBL+C'/',0                                    @SC86224 05133000
  133.          BCT   2,RTRN0       Not valid: must be complex string @SC86224 05134000
  134.          MVC   FSPPTR,SCANPTR                                  @SC86295 05135000
  135.          LA    2,3                                             @SC86295 05136000
  136. FSPCNT   CLI   BRK,C','                                        @SC88306 05137000
  137.          BE    FSPCNZ        Take comma as end                 @SC88306 05137300
  138.          NTOKN N=FSPCNZ                                        @SC88306 05137600
  139.          BCT   2,FSPCNT                                        @SC86295 05138000
  140. FSPCNZ   MVC   SCANPTR,FSPPTR Restore ptrs                     @SC86295 05139000
  141.          N     2,F1                                            @SC86295 05140000
  142.          BNZ   RTRN0         Single token string               @SC86295 05141000
  143.          LA    0,9(3)        Get 2nd token                     @SC86295 05142000
  144.          MVI   0(3),0        Clear length again                @SC86295 05143000
  145.          MVC   FSPBADX,=C'type'                                @SC86295 05144000
  146.          CTOKN NOBRK,H=FSP2H,N=FSPMIS                          @SC89097 05145000
  147.          MVCL  0,6                                             @SC86295 05146000
  148.          B     RTRN0                                           @SC86295 05147000
  149. FSPTAK   TM    FSPFLG,FFGIV  GIVE command?                     @SC88049 05150000
  150.          BO    *+10          Yes, keep specific FM             @SC87117 05151000
  151.          MVC   16(2,1),ASTER Default FM for TAKE               @SC86295 05152000
  152.          MVC   8(8,1),=CL8'TAKE'                               @SC86295 05153000
  153. FSPCPY   LA    5,LFID(,1)    Point to file options             @SC89218 05154000
  154.          CTOKN NOBRK,H=FSPH,N=FSPZ,OPTS=0                      @SC89218 05154500
  155.          TM    FSPFLG,FFRCF                                    @SC86295 05155000
  156.          BZ    FSPCPN                                          @SC86295 05156000
  157.          CLI   0(6),C'='                                       @SC86224 05157000
  158.          BE    FSPREQ        Go if RECEIVE = ...               @SC86295 05158000
  159.          CLI   0(6),C'*'                                       @SC86224 05159000
  160.          BE    FSPINV                                          @SC86295 05160000
  161. FSPCPN   BAL   14,FSPTOK     Get fn                            @SC87034 05161000
  162.          MVC   FSPBADX,=C'type'                                @SC86295 05162000
  163.          CTOKN H=FSPH,N=FSPZ,OPTS=FSPZ                         @SC89218 05163000
  164.          CLI   0(6),C'='                                       @SC86224 05164000
  165.          BE    FSPINV        Go if RECEIVE xxx =               @SC86295 05165000
  166.          TM    FSPFLG,FFRCF                                    @SC86295 05166000
  167.          BZ    FSPCPT                                          @SC86295 05167000
  168.          CLI   0(6),C'*'                                       @SC86224 05168000
  169.          BE    FSPINV        Go if RECEIVE xxx *               @SC86295 05169000
  170.          OI    FL1,ROVR      Overwrite received fname          @SC86295 05170000
  171. FSPCPT   BAL   14,FSPTOK     Get ft                            @SC87034 05171000
  172.          MVC   FSPBADX,=C'mode'                                @SC86295 05174000
  173.          CTOKN FM,H=FSPH,N=FSPZ,OPTS=FSPZ                      @SC89218 05175000
  174.          TM    FSPFLG,FFRCF                                    @SC86295 05176000
  175.          BZ    FSPCPM                                          @SC86295 05177000
  176.          CLI   0(6),C'*'                                       @SC86224 05178000
  177.          BE    FSPINV                                          @SC86295 05179000
  178. FSPCPM   DS    0H                                              @SC89097 05180000
  179.          BAL   14,FSPTOK     Get fm                            @SC87034 05181000
  180.          B     RTRN0                                           @SC86295 05182000
  181. *                                                                       05183000
  182. FSPREQ   MVC   FSPBADX,=C'type'                                @SC86295 05184000
  183.          CTOKN H=FSPH,N=FSPZ,OPTS=FSPZ  Get ft for RECEIVE =   @SC89218 05185000
  184.          CLI   0(6),C'='                                       @SC86224 05186000
  185.          BNE   FSPINV        Go if FT is not =                 @SC86295 05187000
  186.          CLI   0(6),C'*'                                       @SC86224 05188000
  187.          BE    FSPINV        Bad FM                            @SC86295 05189000
  188.          MVC   FSPBADX,=C'mode'                                @SC86295 05190000
  189.          CTOKN FM,H=FSPH,N=FSPZ,OPTS=FSPZ Pick fm              @SC89218 05192000
  190.          BAL   14,FSPTOK     Use FM they specified             @SC87034 05193000
  191.          MVC   UFM,0(1)      Use for all of file group         @SC87034 05194000
  192.          B     RTRN0                                           @SC87034 05195000
  193. *                                                                       05196000
  194. FSPTOK   LR    8,0           Save start                        @SC87034 05197000
  195.          LR    9,1           And length                        @SC87034 05198000
  196.          MVCL  0,6           Copy token with padding           @SC87034 05199000
  197.          LR    1,8                                             @SC87034 05200000
  198.          BCTR  9,0           Fix for TR                        @SC87034 05201000
  199.          EX    9,TRUPCAS     Upcase the token                  @SC87034 05202000
  200.          BR    14                                              @SC87034 05203000
  201. *                                                                       05203050
  202. FSPDOTS  LTR   1,7           Copy length-1                     @SC89097 05203100
  203.          BNPR  14            Can't convert if just '.'         @SC89097 05203150
  204.          LR    9,6           Copy start of token               @SC89097 05203200
  205. FSPDOTL  CLI   1(9),C'.'     Scan for '.', if any              @SC89097 05203250
  206.          BE    FSPDOTF       Found one                         @SC89097 05203300
  207.          LA    9,1(,9)       Keep looking                      @SC89097 05203350
  208.          BCT   1,FSPDOTL                                       @SC89097 05203400
  209.          BR    14            Not found, ordinary token         @SC89097 05203450
  210. FSPDOTF  LR    7,9           Found dot: break up token         @SC89097 05203500
  211.          SR    7,6           Length-1 of stuff before dot      @SC89097 05203550
  212.          LM    8,9,SCANPTR                                     @SC89097 05203600
  213.          SR    9,1           Back up over brk + post-dot stuff @SC89097 05203650
  214.          AR    8,1           ... and increase length left      @SC89097 05203700
  215.          STM   8,9,SCANPTR                                     @SC89097 05203750
  216.          MVI   BRK,C' '      Reset separator too               @SC89218 05203770
  217.          BR    14                                              @SC89097 05203800
  218. *                                                                       05204000
  219. FSPZ     LR    14,0                                            @SC86295 05205000
  220.          CLI   0(14),C' '    Any default given?                @SC86295 05206000
  221.          BH    RTRN0         Yes, use it                       @SC86295 05207000
  222. FSPMIS   MVC   FSPBAD,=C'Missing'                              @SC86295 05208000
  223. FSPINV   LA    15,2                                            @SC86295 05209000
  224.          B     FSPPTRS                                         @SC86295 05210000
  225. *                                                                       05211000
  226. FSPH     PTEXT 'Filespec has format: fn ft [fm][<first-last>]' @SC89261 05212000
  227.          CLI   FSPFLG,FFSND  SEND 1st?                         @SC89261 05212200
  228.          BE    *+8           Yes, use whole message            @SC89261 05212400
  229.           SH   4,=H'14'      Chop off option part              @SC89261 05212600
  230.          B     FSP0H                                           @SC86295 05213000
  231. FSP2H    PTEXT 'Enter foreign filespec'                        @SC86295 05214000
  232. FSP0H    LA    15,1                                            @SC86295 05215000
  233. FSPPTRS  RETREG 3,4          Return msg ptrs                   @SC86295 05216000
  234. FSPRET   RET   ,                                               @SC86295 05218000
  235. *                                                                       05219000
  236. * Non-parsing functions . . .                                           05220000
  237. *                                                                       05221000
  238. * Get unique filespec                                                   05222000
  239. FSPWRN   LR    4,1           Save name ptr                     @SC86295 05223000
  240.          TM    FSPFLG,FFENC                                    @SC86295 05224000
  241.          BO    FSPENC        Encode name into buffer           @SC86295 05225000
  242.          TM    FSPFLG,FFDSP                                    @SC86295 05226000
  243.          BO    FSPDSP        Copy name into buffer for display @SC86295 05227000
  244.          TM    FL4,NMOK      Already checked?                  @SC87012 05228000
  245.          BO    RTRN0         Yes, ok                           @SC87012 05229000
  246.          MVC   XFILE,0(1)    Save original name                @SC90033 05229500
  247.          LA    6,8+6(1)      End of FT                         @BS86001 05230000
  248.          BCTR  6,0                                             @BS86001 05231000
  249.          CLI   0(6),C' '     Find end of token                 @BS86001 05232000
  250.          BE    *-6                                             @BS86001 05233000
  251.          LA    5,10+1        Allowed retries                   @BS86001 05234000
  252.          LA    7,C'0'        Extra character                   @BS86001 05235000
  253.          OI    FL4,NMOK      Assume it checks                  @SC87012 05236000
  254. FSPSTA   OPENF T,(4),E=RTRN0 Does it exist already?            @SC86135 05237000
  255.          OI    FL4,NMCHNG    Yes, remember collision occurred  @SC90033 05237500
  256.          MVI   1(6),C'$'     Yes, modify FT                    @BS86001 05238000
  257.          STC   7,2(6)        Serialize                         @BS86001 05239000
  258.          LA    7,1(7)        Bump counter                      @BS86001 05240000
  259.          BCT   5,FSPSTA                                        @BS86001 05241000
  260.          PTEXT 'Filename collision'                            @SC88049 05242000
  261.          B     FSP0H         Return error code                 @SC88049 05242500
  262. *                                                                       05243000
  263. * Encode name at (R1) into (R7) buffer (in ASCII), possibly with        05244000
  264. *  substitution from JFSPEC, but disable subsequent subst.              05245000
  265. *  Return updated ptr in R15                                            05246000
  266. FSPENC   LA    1,JFSPEC      Complex string?                   @SC86224 05247000
  267.          LA    5,JFNAM       Remote file-spec                  @SC86155 05248000
  268.          BAL   14,PAKFOR                                       @SC86224 05249000
  269.          BNZ   FSPFILS       Yes, tokens aren't used           @SC86224 05250000
  270.          BAL   14,FSPFID     Filename                          @HF86223 05251000
  271.          LA    7,1(7)        Skip over period                  @HF86223 05252000
  272.          BAL   14,FSPFID     Filetype                          @HF86223 05253000
  273. FSPFILS  MVI   JFSPEC,0      Turn off string                   @SC86224 05254000
  274.          CLI   JFN,C'='      Partial renaming?                 @SC86224 05255000
  275.          BE    FSPENR        Yes, keep it                      @SC86224 05256000
  276.          CLI   JFT,C'='                                        @SC86224 05257000
  277.          BE    FSPENR                                          @SC86224 05258000
  278.          MVI   JFN,C'='      Now use original name             @SC86171 05259000
  279.          MVI   JFT,C'='                                        @SC86171 05260000
  280. FSPENR   LR    15,7          Save ptr                          @SC86295 05261000
  281.          B     FSPRET                                          @SC86295 05262000
  282. *                                                                       05263000
  283. * Copy name at (R1) into (R7) buffer in display form                    05264000
  284. *  Return updated ptr in R15                                            05265000
  285. FSPDSP   BAL   14,FSPDTK     Filename                          @SC86295 05266000
  286.          BAL   14,FSPDTK     Filetype                          @SC86295 05267000
  287.          MVC   0(2,7),0(4)   Filemode                          @SC86295 05268000
  288.          LA    7,2(7)                                          @SC86295 05269000
  289.          B     FSPENR                                          @SC86295 05270000
  290. *                                                                       05271000
  291. * Subroutine to detokenize a list into ASCII                   @SC86135 05272000
  292. FSPFID   MVC   0(8,7),0(4)   Copy token                        @SC86135 05273000
  293.          CLI   0(5),C'='     Keep true name?                   @SC86171 05274000
  294.          BE    *+10          Yes                               @SC86171 05275000
  295.          MVC   0(8,7),0(5)   No, use override                  @SC86171 05276000
  296.          LA    1,8(7)        End of token if no blanks         @SC86135 05277000
  297.          TRT   0(8,7),TRTBL  Find 1st blank                    @SC86135 05278000
  298.          TR    0(8,7),ETOAD  ASCII it                          @SC89301 05279000
  299.          LR    7,1           New end of string                 @SC86135 05280000
  300.          LA    4,8(4)        Next token                        @SC86135 05281000
  301.          LA    5,8(5)                                          @SC86171 05282000
  302.          MVI   0(7),ADOT     Add an ASCII dot, just in case    @SC86135 05283000
  303.          BR    14                                              @SC86135 05284000
  304. *                                                                       05285000
  305. * Subroutine to detokenize a list in EBCDIC                    @SC86295 05286000
  306. FSPDTK   MVC   0(8,7),0(4)   Copy token                        @SC86135 05287000
  307.          LA    1,8(7)        End of token if no blanks         @SC86135 05288000
  308.          TRT   0(8,7),TRTBL  Find 1st blank                    @SC86135 05289000
  309.          MVI   0(1),C' '     Add a BLANK                       @SC86295 05290000
  310.          LA    7,1(1)        New end of string                 @SC86135 05291000
  311.          LA    4,8(4)        Next token                        @SC86135 05292000
  312.          BR    14                                              @SC86135 05293000
  313. *                                                                       05294000
  314. * Subroutine to set up CMS token for copying                   @SC86224 05295000
  315. CMSTOK8  LA    7,1(7)                                          @SC86224 05296000
  316.          ICM   7,8,BLANK                                       @SC86224 05297000
  317.          LA    1,8                                             @SC86224 05298000
  318.          BR    14                                              @SC86224 05299000
  319. *                                                                       05300000
  320. * Table to convert EBCDIC text to upper case + dot to blank    @SC89215 05300100
  321. FSPUPDOT DC    (C'.')AL1(*-FSPUPDOT)                           @SC89215 05300200
  322.          DC    C' '                                            @SC89215 05300300
  323.          DC    (127-C'.')AL1(*-FSPUPDOT)                       @SC89215 05300400
  324.          HTBL  80,C1,C2,C3,C4,C5,C6,C7,C8,C9,8A,8B,8C,8D,8E,8F @SC89268 05300500
  325.          HTBL  90,D1,D2,D3,D4,D5,D6,D7,D8,D9,9A,9B,9C,9D,9E,9F @SC89268 05300600
  326.          HTBL  A0,A1,E2,E3,E4,E5,E6,E7,E8,E9,AA,AB,AC,AD,AE,AF @SC89268 05300700
  327.          DC    080AL1(*-FSPUPDOT)                              @SC89215 05300800
  328. * Valid CMS file name characters                               @SC86295 05301000
  329. FSPTAB   DC    64C'_',C' '           space                     @SC86295 05302000
  330.          DC    10C'_',C' '           dot                       @SC86295 05303000
  331.          DC    02C'_',C'+'           plus                      @SC86295 05304000
  332.          DC    12C'_',C'$'           dollar sign               @SC86295 05305000
  333.          DC    04C'_',C'-'           dash                      @SC86295 05306000
  334.          DC    12C'_',C'_'           underscore                @SC86295 05307000
  335.          DC    12C'_',C':#@'         colon, pound sign, at sign@SC86295 05308000
  336.          DC    04C'_',C'ABCDEFGHI'   a-i                       @SC86295 05309000
  337.          DC    07C'_',C'JKLMNOPQR'   j-r                       @SC86295 05310000
  338.          DC    08C'_',C'STUVWXYZ'    s-z                       @SC86295 05311000
  339.          DC    23C'_',C'ABCDEFGHI'   A-I                       @SC86295 05312000
  340.          DC    07C'_',C'JKLMNOPQR'   J-R                       @SC86295 05313000
  341.          DC    08C'_',C'STUVWXYZ'    S-Z                       @SC86295 05314000
  342.          DC    06C'_',C'0123456789'  0-9                       @SC86295 05315000
  343.          DC    06C'_'                                          @SC86295 05316000
  344.          LOCALS ,                                              @SC86295 05317000
  345. FSPBAD   DS    C'Invalid',C' file'                             @SC86295 05318000
  346. FSPBADX  DS    C'name'                                         @SC86295 05319000
  347. FSPPTR   DS    XL8           Saved scan ptrs                   @SC86295 05320000
  348. FSPFLG   DS    X             Filespec flags                    @SC86295 05321000
  349. FSPEC    EXIT                                                  @SC86295 05322000
  350.          TITLE 'KHELP routine - perform HELP command'                   05323000
  351. * Handle HELP command, rest of string given by SCANPTR.                 05324000
  352. KHELP    ENTER ,                                               @SC86355 05325000
  353. * CMS version ignores any extra operands on HELP command       @SC86355 05326000
  354.          LA    2,KRMNAM      Ptr to original command name      @SC88049 05327000
  355.          CLI   0(2),C'*'     Was it a START?                   @SC86355 05328000
  356.          BE    KHLDF         Yes, use default                  @SC86355 05329000
  357.          CLI   0(2),X'FF'    Nothing at all?                   @SC86355 05330000
  358.          BNE   KHLI          Something, use it                 @SC87007 05331000
  359. KHLDF    LA    2,=CL8'KERMIT'                                  @SC86355 05332000
  360. KHLI     LA    1,CMD         Command buffer                    @SC87007 05333000
  361.          MVC   0(5,1),=CL5'HELP'                               @SC86355 05334000
  362.          MVC   5(30,1),0(2)  Copy operand                      @SC86355 05335000
  363.          LA    0,5+8         Length of command                 @SC86355 05336000
  364.          STM   0,1,SCANPTR   Set up for system                 @SC86355 05337000
  365.          OI    FL4,UCMD                                        @SC86355 05338000
  366.          KCALL SUPFNC,3      Do it                             @SC86355 05339000
  367.          RET   ,                                               @SC86355 05340000
  368.          LOCALS ,                                                       05341000
  369. KHELP    EXIT  ,                                               @SC87007 05342000
  370.          TITLE 'SUPFNC Routine - various supervisor functions' @SC86158 05343000
  371. SUPFNC   ENTER                                                 @SC86295 05344000
  372. *  On entry, R1 = operation code, R0 = possible ptr            @SC86158 05345000
  373. * Exit: R15 set (0 => ok, <0 => illegal cmd, >0 => depends)             05346000
  374. *       ERRNUM set appropriately (R1=1,3,4) or unchanged (2,5-11)       05347000
  375. * 1 -> Start typeout interception.  N.B.  &MAXLR >> 2048 for this       05348000
  376. * 2 -> Clean up afterwards and stop interception                        05349000
  377. * 3 -> Execute host command with or without interception                05350000
  378. *      If UCMD set, SCANPTR gives text, else R0->text,R6=len            05351000
  379. * 4 -> Execute CP command with or without interception                  05352000
  380. *      R0->text, R6=len                                                 05353000
  381. * 5 -> Stop interception if going                                       05354000
  382. * 6 -> Retrieve original cmd parm string into CBUF (R15=1 if null)      05355000
  383. * 7 -> Test for stacked lines, return number in R15                     05356000
  384. * 8 -> Log off (doesn't return!)                                        05357000
  385. * 9 -> Wait specified time                                              05358000
  386. * 10-> Return clock time in R15 (centisec)                              05359000
  387. * 11-> Setup up new prompt string at (R0)                               05360000
  388.          BCT   1,ICPFIN                                        @SC86158 05361000
  389. * Start interception, initialize ptrs                          @SC86158 05362000
  390.          MVI   ERRNUM,ERRNOE OK                                @SC86158 05363000
  391.          LA    0,2048        Suitable offset                   @SC86158 05364000
  392.          A     0,WBUF        Output buffer                     @SC86158 05365000
  393.          L     1,TSENT       Limit                             @SC86158 05366000
  394.          LR    15,0                                            @SC86158 05367000
  395.          STM   15,0,TXTPTR   Save                              @SC86158 05368000
  396.          STM   0,1,SVCOPTR                                     @SC86158 05369000
  397.          SR    1,0           Get length                        @SC86158 05370000
  398.          L     15,=X'15000000'                                 @SC86158 05371000
  399.          MVCL  0,14          Fill with NL (X'15')              @SC86158 05372000
  400.          MVI   SVCSNAG+1,0   370-mode PSW                      @SC89235 05372100
  401.          LA    14,SVCOPSW+3  Assume page 0 version             @SC89235 05372200
  402.          TM    FLGXA,XACMS   XA mode?                          @SC89235 05372300
  403.          BZ    SFCSVCST      No, fine                          @SC89235 05372400
  404.          MVI   SVCSNAG+1,X'08'  XA-mode PSW                    @SC89235 05372500
  405.          AIF   ('&KTAG' NE 'XA').CMSXA1                        @SC90067 05372550
  406.          L     1,ASVCSECT    Ptr to SVC info                   @SC89235 05372600
  407.          USING SVCSECT,1                                       @SC89235 05372700
  408.          LA    14,SVCOCODE   Use XA version                    @SC89235 05372800
  409. .CMSXA1  ANOP                                                  @SC90067 05372850
  410. SFCSVCST ST    14,SVCOCPTR   Correct ptr to SVC code           @SC89235 05372900
  411.          CLC   SVCNPSW,SVCSNAG  Already set up?                @SC86158 05373000
  412.          BE    RTRN0         Yes, but how?                     @SC86295 05374000
  413.          MVC   SAVENPSW,SVCNPSW                                @SC86158 05375000
  414.          MVC   TYPSAV,ADMSCWR                                  @SC86283 05376000
  415.         DMSKEY NUCLEUS                                         @SC86283 05377000
  416.          MVC   SVCNPSW,SVCSNAG Set up interception (SVC)       @SC86283 05378000
  417.          MVC   ADMSCWR,=A(ICPTYP)  (BALR)                      @SC86283 05379000
  418.         DMSKEY RESET                                           @SC86283 05380000
  419.          B     RTRN0                                           @SC86295 05381000
  420. * Clean up after interception                                  @SC86295 05382000
  421. ICPFIN   BCT   1,ICPHST                                        @SC86158 05383000
  422.          L     5,SVCOPTR     End of text                       @SC86158 05384000
  423.          ST    5,TXTPTR+4    Save                              @SC86158 05385000
  424.          B     ICPRST1       Now restore interrupts            @SC86295 05386000
  425. * Restore SVC interrupt vector                                 @SC86158 05387000
  426. ICPRST   BCT   1,SFCLIN                                        @SC86295 05388000
  427. ICPRST1  CLC   SVCNPSW,SVCSNAG                                 @SC86295 05389000
  428.          BNE   RTRN0         OK                                @SC86295 05390000
  429.         DMSKEY NUCLEUS                                         @SC86283 05391000
  430.          MVC   SVCNPSW,SAVENPSW                                @SC86283 05392000
  431.          MVC   ADMSCWR,TYPSAV                                  @SC86283 05393000
  432.          NI    MSGFLAGS,255-NOTYPING                           @SC88309 05393500
  433.         DMSKEY RESET                                           @SC86283 05394000
  434.          B     RTRN0                                                    05395000
  435. * Avoid user-area CMS commands, otherwise execute command at   @SC86158 05396000
  436. *  (R0) already tokenized. Save return code.                   @SC86158 05397000
  437. ICPHST   BCT   1,ICPCP                                         @SC86158 05398000
  438.          TM    FL4,UCMD      User CMS command?                 @SC86295 05399000
  439.          BZ    ICPCMS0       No, already tokenized             @SC86295 05400000
  440.          LM    0,1,SCANPTR                                     @SC86295 05401000
  441.          LTR   15,0                                            @SC87034 05402000
  442.          BNP   ICPCMIL       Nothing there                     @SC87034 05403000
  443.         DMSKEY NUCLEUS       Enter Key 0                       @SC86295 05406000
  444.          L     15,ASCANN                                       @SC86295 05407000
  445.          BALR  14,15         Tokenize data                     @SC86295 05408000
  446.          LR    3,0           Length of tokenized list          @SC90073 05408200
  447.          BCTR  3,0           Get length for TR                 @SC90073 05408400
  448.          EX    3,TRUPCAS     Convert to upper case             @SC90073 05408600
  449.          LR    0,15                                            @SC86295 05409000
  450.         DMSKEY RESET         Restore user key                  @SC86295 05410000
  451.          LTR   15,0          Did SCANN fail?                   @SC86295 05411000
  452.          BNZ   ICPCMIL       Yes                               @SC86295 05412000
  453.          C     3,F8          Did we get anything?              @SC90073 05412300
  454.          BNH   ICPCMIL       No, just a fence.  Give up        @SC90073 05412600
  455.          LR    0,1                                             @SC86295 05413000
  456. ICPCMS0  LR    3,0                                             @SC86295 05414000
  457.          CLC   =C'CP ',0(3)  CP command?                       @SC86158 05415000
  458.          BE    ICPCMSCP      Yes, do it                        @SC86158 05416000
  459.          MVI   TRTBL+C'%',1  Possible wildcard chars           @SC90037 05416100
  460.          MVI   TRTBL+C'*',1                                    @SC90037 05416200
  461.          TRT   0(8,3),TRTBL  See if any % or * in FN           @SC90037 05416300
  462.          MVI   TRTBL+C'%',0  Restore TRTBL                     @SC90037 05416400
  463.          MVI   TRTBL+C'*',0                                    @SC90037 05416500
  464.          BZ    *+12          No wild chars found               @SC90037 05416600
  465.           CLI  0(1),C' '     Maybe just a blank?               @SC90037 05416700
  466.           BNE  ICPCMIL       No, illegal                       @SC90037 05416800
  467.          MVC   IFT,=CL8'EXEC'                                  @SC86158 05417000
  468.          MVC   IFM,ASTER     Search all disks                  @SC86158 05418000
  469.          TM    OPTFLAGS,NOIMPEX  EXEC's allowed?               @SC86158 05419000
  470.          BO    ICPCMSM       No, try for module                @SC86158 05420000
  471.          TM    FL4,UCMD      User CMS command?                 @SC86158 05421000
  472.          BZ    ICPCMSM       No, avoid EXEC's                  @SC86158 05422000
  473. ICPCMSA  MVC   IFN,0(3)                                        @SC86158 05423000
  474.          LA    4,1                                             @SC86158 05424000
  475. ICPCMSS  FSSTATE FSCB=IFSCB,ERROR=ICPABBR See if exists        @SC90037 05425000
  476.          LR    5,1                                             @SC86295 05427000
  477.          USING FSTSECT,5                                       @SC90037 05428000
  478.         DMSEXS MVC,0(8,3),IFN Found, copy full name            @SC86158 05431000
  479.          CLI   IFT,C'E'      EXEC?                             @SC86158 05432000
  480.          BNE   ICPCMSU       No, module. Check it              @SC86158 05433000
  481.          S     3,F8          Back up to EXEC in COMBUF         @SC86158 05434000
  482.          DMSEXS MVC,NUCPLBEG,NUCPLCMD Argst begins w/ cmd name @SC89264 05434500
  483.          B     ICPCMSX       Do it                             @SC86158 05435000
  484. ICPABBR  LTR   4,4           Already tried abbrev?             @SC86158 05436000
  485.          BZ    ICPCMSM       Yes, give up                      @SC86158 05437000
  486.          TM    OPTFLAGS,NOABBREV Allowed?                      @SC86158 05438000
  487.          BO    ICPCMSM       No, just do it                    @SC86158 05439000
  488.         DMSKEY NUCLEUS                                         @SC86158 05440000
  489.          LM    0,1,0(3)      Get name entered                  @SC86158 05441000
  490.          L     15,AABBREV    Look up abbreviation              @SC86158 05442000
  491.          BALR  14,15                                           @SC86158 05443000
  492.          LR    4,15          Save RC                           @SC86158 05444000
  493.         DMSKEY RESET         Return to normal                  @SC86158 05445000
  494.          LTR   4,4           Did we find one?                  @SC86158 05446000
  495.          BNZ   ICPCMSM       No, give up                       @SC86158 05447000
  496.          STM   0,1,IFN       Yes, try it                       @SC86158 05448000
  497.          B     ICPCMSS       Now R4=0, don't loop              @SC86158 05449000
  498. ICPCMSM  CLI   IFT,C'M'                                        @SC86158 05450000
  499.          BE    ICPCMEX       Already looked                    @SC90037 05451000
  500.          MVC   IFT,=CL8'MODULE'                                @SC86158 05452000
  501.          B     ICPCMSA       Start over again                  @SC86158 05453000
  502. ICPCMEX  CLC   =CL8'EXEC',IFN Are we looking for an EXEC?      @SC90037 05453600
  503.          BNE   ICPCMSX       No, just execute it               @SC90037 05453900
  504.          MVC   IFN,8(3)      Yes, see if it exists             @SC90037 05454200
  505.          MVC   IFT,=CL8'EXEC'                                  @SC90037 05454500
  506.          FSSTATE FSCB=IFSCB,ERROR=ICPCMIL See if exists        @SC90037 05454800
  507.          B     ICPCMSX                                         @SC90037 05455100
  508. ICPCMSU  CLI   FSTFV,C'F'    System-key transient?             @SC90037 05455400
  509.          BE    ICPCMSX       OK, no problem                    @SC86158 05456000
  510.          MVC   IFM,FSTM      Get right mode letter             @SC86158 05457000
  511.          DROP  5                                               @SC90037 05457500
  512.          LA    2,CMD         Buffer for 1st record of module   @SC86295 05458000
  513.          MVC   4(4,2),=A(KERMIT)  In case of failure           @SC86295 05459000
  514.         FSREAD FSCB=IFSCB,BUFFER=(2)  Get header record        @SC86295 05461000
  515.        FSCLOSE FSCB=IFSCB                                      @SC86158 05462000
  516.          CLC   =A(KERMIT),CMD+4 Check beginning adr            @SC86158 05463000
  517.          BH    ICPCMSX       Below Kermit, assume it's ok      @SC89023 05463300
  518.          CLC   =XL4'20000',=A(KERMIT) Are we both user-area?   @SC89023 05463600
  519.          BNH   ICPCMIL       User-area, forbid it              @SC86158 05464000
  520. ICPCMSX  HOST  0(3),E=*+4,EPL=YES  Accept errors, use ext.PL.  @SC89264 05465000
  521.          LTR   6,15          Save return code                  @SC86295 05466000
  522.          BNM   SFCRC                                           @SC86295 05467000
  523.          TM    OPTFLAGS,NOIMPCP                                @SC86295 05468000
  524.          BO    ICPCMIL       No implied CP commands            @SC86295 05469000
  525.          TM    FL4,UCMD      User command?                     @SC86295 05470000
  526.          BO    ICPCMSCP      Yes, maybe it's for CP            @SC86295 05471000
  527. ICPCMIL  MVI   ERRNUM,ERRSYS Illegal system command            @SC86295 05472000
  528.          B     RTRNM1                                          @SC86295 05473000
  529. ICPCMP   CLC   1(,4),0(3)    Partial token matching            @SC86158 05474000
  530. IFSCB    FSCB  'X X',BSIZE=80,RECNO=1,RECFM=V                  @SC86158 05475000
  531. IFN      EQU   IFSCB+8,8                                       @SC90037 05475200
  532. IFT      EQU   IFN+8,8                                         @SC90037 05475400
  533. IFM      EQU   IFT+8,2                                         @SC90037 05475600
  534. * Execute CP command sent to CMS (assumed SCANN'ed)            @SC86158 05476000
  535. ICPCMSCP L     0,NUCPLCMD    Get cmd ptr                       @SC86158 05477000
  536.          L     6,NUCPLEND                                      @SC86158 05478000
  537.          SR    6,0           Get length                        @SC86158 05479000
  538.          LA    1,1           Simulate normal entry             @SC86158 05480000
  539. * Execute CP command at (R0) with text interception            @SC86158 05481000
  540. ICPCP    BCT   1,ICPRST                                        @SC86158 05482000
  541.          LR    1,0           Copy ptr for upcasing             @SC87034 05483000
  542.          LTR   4,6                                             @SC87034 05484000
  543.          BNP   ICPCMIL       Nothing there                     @SC87034 05485000
  544.          BCTR  4,0                                             @SC87034 05486000
  545.          EX    4,TRUPCAS                                       @SC87034 05487000
  546.          CLC   SVCNPSW,SVCSNAG                                 @SC86283 05488000
  547.          BNE   ICPCDG        Not intercepting, just do it      @SC86283 05489000
  548.          KCALL SETMSG,3      Restore CP settings               @SC86158 05490000
  549.          LM    1,2,SVCOPTR   Response buffer                   @SC86158 05491000
  550.          SR    2,1           Get buffer length                 @SC86158 05492000
  551.          L     7,=F'8192'    Max length from CP                @SC86158 05493000
  552.          CR    7,2           Do we have that much?             @SC86158 05494000
  553.          BNH   *+6                                             @SC86158 05495000
  554.          LR    7,2           Use what we have                  @SC86158 05496000
  555.          LR    2,7           Remember                          @SC86158 05497000
  556.          ICM   6,8,BLANK                                       @SC86158 05498000
  557.          DIAG  0,6,8         Issue command                     @SC86158 05499000
  558.          BZ    *+6                                             @SC86158 05500000
  559.          LR    7,2           Not likely: filled buffer         @SC86158 05501000
  560.          A     7,SVCOPTR                                       @SC86158 05502000
  561.          BCTR  7,0           Scan back over any extra X'15'    @SC86158 05503000
  562.          CLI   0(7),X'15'                                      @SC86158 05504000
  563.          BE    *-6                                             @SC86158 05505000
  564.          LA    7,2(7)        Keep one X'15'                    @SC86158 05506000
  565.          C     7,SVCOPTR+4   Be careful of end                 @SC86158 05507000
  566.          BNH   *+8           OK                                @SC86158 05508000
  567.          L     7,SVCOPTR+4   Got past it somehow               @SC86158 05509000
  568.          ST    7,SVCOPTR                                       @SC86158 05510000
  569.          KCALL SETMSG,2      Change CP settings again          @SC86158 05511000
  570.          B     ICPRC                                           @SC86295 05512000
  571. *                                                                       05513000
  572. ICPCDG   DIAG  0,6,8         Issue command                     @SC86283 05514000
  573. ICPRC    C     6,F1          Illegal command?                  @SC86295 05515000
  574.          BE    ICPCMIL       Yes                               @SC86295 05516000
  575. * Issue return code msg if needed                              @SC86295 05517000
  576. SFCRC    LTR   4,6           Check RC                          @SC86295 05518000
  577.          BZ    SFCZRC        RC=0                              @SC86158 05519000
  578.          TM    FL4,UCMD      User cmd?                         @SC86316 05520000
  579.          BZ    SFCZRC        No, don't issue message           @SC86316 05521000
  580.          MVC   CMD(2),=C'R(' Set up message                    @SC86209 05522000
  581.          LA    15,CMD+2                                        @SC86209 05523000
  582.          BAL   2,EDDEC       Edit RC into msg                  @SC86295 05524000
  583.          MVI   0(15),C')'    Format is R(rc)                   @SC86209 05525000
  584.          LA    0,1(15)                                         @SC86268 05526000
  585.          LA    1,CMD         Start of edited string            @SC86209 05527000
  586.          SR    0,1           Length                            @SC86268 05528000
  587.          WTEXT (1),(0)                                         @SC86268 05529000
  588. SFCZRC   LR    15,6                                            @SC86295 05530000
  589.          MVI   ERRNUM,ERRNOE No errors                         @SC86295 05531000
  590.          B     RTRN                                            @SC86295 05532000
  591. *                                                                       05533000
  592. SFCLIN   BCT   1,SFCSTK                                        @SC86295 05534000
  593. * Retrieve original command line arguments, if any             @SC86295 05535000
  594. *   Return code =0 if yes, =1 if no                            @SC86295 05536000
  595. *   Leave string in CBUF buffer (up to 512), length in CLEN    @SC89235 05537000
  596.          LM    5,6,ORGR0     Original R0,R1                    @SC87253 05538000
  597.          CLI   0(6),255                                        @SC86171 05539000
  598.          BE    RTRN1         Go if, e.g., just 'START'         @SC86171 05540000
  599.          LA    6,8(6)        Ok, point to arguments            @SC86171 05541000
  600.          CLI   0(6),255                                        @SC86171 05542000
  601.          BE    RTRN1         Go if nothing on cmd                       05543000
  602.          L     8,CBUF        A safe data area                  @SC89235 05544000
  603.          LA    9,512         Length of buffer                  @SC89235 05544500
  604.          CLI   ORGR1,1                                         @SC87253 05545000
  605.          BL    SFCCMDK       R1 hi order byte is 0                      05546000
  606.          CLI   ORGR1,11                                        @SC87253 05547000
  607.          BH    SFCCMDK       R1 hi order byte is > X'0B'                05548000
  608.          LM    6,7,4(5)      Address of arguments, end         @SC89235 05549000
  609.          SR    7,6           Get length                        @SC89235 05549500
  610.          CR    9,7           How much info?                    @SC89235 05550000
  611.          BNH   *+6           Ok                                @SC89235 05550500
  612.           LR   9,7           Copy only what's there            @SC89235 05551000
  613.          ST    9,CLEN        Save command length               @SC89235 05551500
  614.          MVCL  8,6                                             @SC89235 05552000
  615.          B     RTRN0                                           @SC89235 05552500
  616. *                                                                       05554000
  617. SFCCMDK  AR    9,8           Ptr to end of buffer              @SC89235 05555000
  618. SFCCMDKL MVC   0(8,8),0(6)   Copy token                        @SC89235 05555700
  619.          LA    1,8(,8)       Char after token                  @SC89235 05556400
  620.          TRT   0(8,8),TRTBL  Find blank                        @SC89235 05557100
  621.          MVI   0(1),C' '     Add a blank, in case              @SC86295 05558000
  622.          LA    8,1(,1)       Skip over blank                   @SC89235 05559000
  623.          LA    6,8(6)        Skip a CMS token                           05560000
  624.          CLI   0(6),255                                                 05561000
  625.          BE    SFCCMDKM      End of str, quit copying          @SC89235 05562000
  626.           CR   8,9           Is it too long?                   @SC89235 05563000
  627.           BL   SFCCMDKL      Loop if more room                 @SC89235 05564000
  628. SFCCMDKM S     8,CBUF        Length = current pos - beginning  @SC89235 05565000
  629.          ST    8,CLEN        Save command length               @SC89235 05566000
  630.          B     RTRN0                                           @SC86295 05568000
  631. *                                                                       05569000
  632. * Test for stacked commands                                    @SC86295 05570000
  633. *   return code = number of stacked lines                      @SC86295 05571000
  634. SFCSTK   BCT   1,SFCKIL                                        @SC86295 05572000
  635.          LH    15,NUMFINRD   Pending lines                     @SC86295 05573000
  636.          A     15,NUCNLSTK   Lines in program stack            @SC86295 05574000
  637.          B     RTRN                                            @SC86295 05575000
  638. *                                                                       05576000
  639. * Log out                                                      @SC86295 05577000
  640. SFCKIL   BCT   1,SFCWT                                         @SC86295 05578000
  641.          CPCMD 1,0,'LOGOFF'                                    @SC86295 05579000
  642. *                                                                       05580000
  643. * Wait specified time in R0 (sec)                                       05581000
  644. SFCWT    BCT   1,SFCCLK                                        @SC86295 05582000
  645.        LINEDIT TEXT='SL ..... SEC',DOT=NO,DISP=CPCOMM,                 +05583000
  646.                SUB=(DEC,(0))                                   @SC86184 05584000
  647.          B     RTRN0                                           @SC86295 05585000
  648. *                                                                       05586000
  649. * Return time in centisec in R15                                        05587000
  650. SFCCLK   BCT   1,SFCPRP                                        @SC87351 05588000
  651.          STCK  TMPDW         Store TOD clock                   @SC86295 05589000
  652.          LM    14,15,TMPDW                                     @SC86295 05590000
  653.          SLDL  14,8          Take mod 204 days                 @SC86295 05591000
  654.          SRDL  14,20         Get in microsec                   @SC86295 05592000
  655.          D     14,=F'10000'  Get in centisec                   @SC86295 05593000
  656.          B     RTRN                                            @SC86295 05594000
  657. *                                                                       05595000
  658. * Set up prompt string                                         @SC89334 05596000
  659. SFCPRP   ICM   4,1,S1HND     See if handshake is defined       @SC89334 05596050
  660.          BZ    RTRN0         No, skip it                       @SC89334 05596100
  661.          LR    1,0           Ptr to prompt string              @SC89334 05596150
  662.          BCTR  1,0           Ptr to prompt string length       @SC89334 05596200
  663.          SR    2,2                                             @SC89334 05596250
  664.          ICM   2,1,0(1)      Get length                        @SC89334 05596300
  665.          BZ    RTRN0         No prompt, leave it to system     @SC89334 05596350
  666.          LA    3,0(2,1)      Point to last character           @SC89334 05596400
  667.          CLM   4,1,0(3)      Is it the handshake?              @SC89334 05596450
  668.          BE    RTRN0         Yes, assume all is well           @SC89334 05596500
  669.          STC   4,1(,3)       No, tack one onto string          @SC89334 05596550
  670.          LA    2,1(,2)       And update length                 @SC89334 05596600
  671.          STC   2,0(,1)                                         @SC89334 05596650
  672.          B     RTRN0                                           @SC89334 05596700
  673.          TITLE 'SVC interceptor,  executed in system protect key'       05597000
  674.          USING ICPTYP,15                                       @SC86283 05598000
  675. ICPTYP   STM   12,14,SVCSV1  Save regs                         @SC86283 05599000
  676.          L     13,SVCSNAG+4  Addressability                    @SC86283 05600000
  677.          DROP  15                                                       05601000
  678.          USING SVCEXIT,13                                      @SC86283 05602000
  679.          B     ICPTGO        Grab it                           @SC86283 05603000
  680. SVCEXIT  STM   12,13,0       Save regs                         @SC86158 05604000
  681.          BALR  13,0          Addressability                    @SC86158 05605000
  682.          USING *,13                                            @SC86158 05606000
  683.          L     13,SVCSNAG+4  Addressability                    @SC86283 05607000
  684.          USING SVCEXIT,13                                      @SC86283 05608000
  685.          ICM   13,8,SVCEXIT  Flag for SVC entry                @SC86283 05609000
  686.          MVC   SVCSV1(8),0                                     @SC86158 05610000
  687.          STM   14,15,SVCSV2                                    @SC86158 05611000
  688.          L     12,AFVS                                         @SC86158 05612000
  689.          USING FVSECT,12                                       @SC86158 05613000
  690.          TM    UFDBUSY,ABNBIT  ABEND in progress?              @SC86158 05614000
  691.          BO    SVCCNCL                                         @SC86158 05615000
  692.          L     14,SVCOCPTR   Correct ptr to SVC code           @SC89235 05616000
  693.          CLI   0(14),13      ABEND?                            @SC89235 05616500
  694.          BE    SVCCNCL                                         @SC86158 05617000
  695.          CLI   0(14),203                                       @SC89235 05618000
  696.          BE    SVC203T       Could be DMSABN                   @SC86158 05619000
  697.          CLI   0(14),204     Used only in CMS 5.5 and above    @SC89235 05619300
  698.          BE    *+12                                            @SC89235 05619600
  699.           CLI  0(14),202                                       @SC89235 05620000
  700.          BNE   SVCGO         Ok, do it                         @SC86158 05621000
  701.          CLC   =CL8'TYPLIN',0(1)  WRTERM?                      @SC86158 05622000
  702.          BNE   SVCGO         No, do it                         @SC86158 05623000
  703. ICPTGO   LM    14,15,SVCOPTR Output ptrs                       @SC86158 05624000
  704.          SR    15,14         Length left                       @SC86158 05625000
  705.          LA    12,255        Limit                             @SC86158 05626000
  706.          CH    12,14(1)      Buffer length                     @SC86295 05627000
  707.          BNH   *+8           Too big                           @SC86158 05628000
  708.          LH    12,14(1)      Ok, use it                        @SC86295 05629000
  709.          LTR   12,12                                           @SC86158 05630000
  710.          BNP   ICPTRET                                         @SC86283 05631000
  711.          CR    12,15         Enough room?                      @SC86283 05632000
  712.          BH    ICPTRET       No                                @SC86283 05633000
  713.          ICM   15,7,9(1)     Buffer address                    @SC86295 05634000
  714.          TM    MSGFLAGS,NOTYPING                               @SC88309 05634100
  715.          BO    ICPTRET       HT is in effect                   @SC88309 05634200
  716.          TM    13(1),X'40'   Error message?                    @SC88309 05634300
  717.          BZ    *+8           No, keep whole text               @SC88309 05634400
  718.          DIAG  15,12,X'5C'   Adjust according to EMSG          @SC88309 05634500
  719.          LTR   12,12         Anything to show?                 @SC88309 05634600
  720.          BNP   ICPTRET       Not anymore                       @SC88309 05634700
  721.          BCTR  12,0          Set up for mvc                    @SC86158 05635000
  722.          EX    12,SVCCOPY    Move to WBUF                      @SC86158 05636000
  723.          LA    14,2(12,14)   New end                           @SC86158 05637000
  724.          TM    13(1),X'80'   Suppress NL?                      @SC88309 05637200
  725.          BZ    *+6           No, keep it                       @SC88309 05637400
  726.          BCTR  14,0          Yes, append next line             @SC88309 05637600
  727.          ST    14,SVCOPTR                                      @SC86158 05638000
  728. ICPTRET  SR    15,15         Success                           @SC86283 05639000
  729.          CLM   13,8,SVCEXIT  Was it an SVC?                    @SC86283 05640000
  730.          BE    SVCDONE       Yes                               @SC86283 05641000
  731.          LM    12,14,SVCSV1  Restore regs                      @SC86283 05642000
  732.          BR    14            Return                            @SC86283 05643000
  733. SVCDONE  L     12,SVCOPSW+4  Return adr                        @SC86158 05644000
  734.          CLI   0(12),0       Error adr given?                  @SC86158 05645000
  735.          BNE   SVCRET                                          @SC86158 05646000
  736.          LA    14,4(12)      Yes, skip over                    @SC86158 05647000
  737. SVCSKP   STCM  14,7,SVCOPSW+5                                  @SC86158 05648000
  738. SVCRET   LM    12,14,SVCSV1  Restore                           @SC86158 05649000
  739.          SR    15,15         'success'                         @SC86158 05650000
  740.          LPSW  SVCOPSW       Return                            @SC86158 05651000
  741. SVCCOPY  MVC   0(,14),0(15)                                    @SC86158 05652000
  742. *                                                                       05653000
  743. SVC203T  L     12,SVCOPSW+4  Code ptr                          @SC86158 05654000
  744. SVCABNT  CLI   1(12),11      DMSABN?                           @SC86158 05655000
  745.          BNE   SVCGO         No, do it                         @SC86158 05656000
  746. SVCCNCL  MVC   SVCNPSW,SAVENPSW  Cancel interception           @SC86158 05657000
  747.          MVC   ADMSCWR,TYPSAV                                  @SC86283 05658000
  748. SVCGO    MVC   0(8,0),SAVENPSW   Proper SVC handler            @SC86158 05659000
  749.          LM    12,15,SVCSV1                                    @SC86158 05660000
  750.          LPSW  0                                               @SC86158 05661000
  751. * Storage for SVC interception                                 @SC86158 05662000
  752. SAVENPSW DS    D             SYSTEM  SVC NPSW                  @SC86158 05663000
  753. SVCSNAG  DC    A(0,SVCEXIT)  My replacement                    @SC86158 05664000
  754. SVCSV1   DS    2F            Saved 12,13                       @SC86158 05665000
  755. SVCSV2   DS    2F            Saved 14,15                       @SC86158 05666000
  756. SVCOPTR  DS    2F            Buffer output and end ptrs        @SC86158 05667000
  757. SVCOCPTR DS    A             Correct ptr to SVC code           @SC89235 05667500
  758. TYPSAV   DS    F             Saved system address              @SC86283 05668000
  759.          LOCALS ,                                              @SC86295 05669000
  760. SUPFNC   EXIT                                                  @SC86158 05670000
  761.          TITLE 'TERMIO Routine - Handle terminal I/O'                   05671000
  762. * R1 points to a pair of (adr,len) for read or write.  If I/O is        05672000
  763. * successfull, R15 returns transferred byte count (else returns -1).    05673000
  764. *               Command code is in R0:                                  05674000
  765. * 1 => Open line for I/O            4 => Write packet                   05675000
  766. * 2 => Close line                   5 => Read packet                    05676000
  767. * 3 => Reset line status after    ( 6 => Write message ) not used       05677000
  768. *      environment changes                                              05678000
  769. *                                                                       05679000
  770. TERMIO   ENTER                                                          05680000
  771.          SR    15,15         OK                                @SC86295 05681000
  772.          BCT   0,TRMCLS                                        @SC86295 05682000
  773. * Open terminal line for protocol                                       05683000
  774.          WAITT                                                          05684000
  775.          STAX  BR14          Ingore attention interrupts                05685000
  776.          MVI   RIOC,X'80'    Nothing saved                     @SC86295 05686000
  777.          MVI   TRMFLG,X'FF'  Initialize w/r flag               @SC87275 05687000
  778.          B     TRMSPRP                                         @SC87275 05688000
  779. * Close terminal line after protocol transfer                           05689000
  780. TRMCLS   BCT   0,TRMRSET                                       @SC86295 05690000
  781.          STAX                                                           05691000
  782.          B     RTRN0                                           @SC86295 05692000
  783. * (Re)set terminal characteristics to suit environment                  05693000
  784. TRMRSET  BCT   0,TRMRW                                         @SC86295 05694000
  785.          B     RTRN0                                           @SC86295 05695000
  786. *                                                                       05696000
  787. *  Perform I/O request                                                  05697000
  788. TRMRW    BCT   0,TRMRD                                         @SC87275 05698000
  789.          CLI   WRRD,0        Write/read?                       @SC87275 05699000
  790.          BE    TRMWO         No, do it immediately             @SC87275 05700000
  791.          MVC   RIOPRP(8),0(1)  Yes, save stuff for prompt      @SC87275 05701000
  792.          B     RTRN0                                           @SC87275 05702000
  793. TRMWO    MVI   TRMFLG,0      Indicate no action on follow-up   @SC87275 05703000
  794.          B     TRMEX         Do the write                      @SC87275 05704000
  795. TRMRD    TS    TRMFLG                                          @SC87275 05705000
  796.          BZ    RTRN0         Just a follow-up. 0-length read   @SC87275 05706000
  797. *                                                                       05707000
  798. TRMEX    SLA   0,4                                             @SC87275 05708000
  799.          LA    8,TRMPLS                                        @SC87275 05709000
  800.          AR    8,0           Get appropriate CCW skeleton      @SC86295 05710000
  801.          MVC   9(3,8),1(1)   Copy adr                          @SC86295 05711000
  802.          MVC   14(2,8),6(1)  Copy len                          @SC86295 05712000
  803.          HOST  0(8)          Issue command                     @SC86295 05713000
  804.          LH    15,14(8)      Number of chars xfer'd            @SC86295 05714000
  805. TRMSPRP  LA    0,S1EOL       Reinstate "normal" prompt         @SC87275 05715000
  806.          LA    1,2                                             @SC87275 05716000
  807.          CLI   S1HND,0       Handshake desired?                @SC87275 05717000
  808.          BNE   *+6           Yes, ok                           @SC87275 05718000
  809.          BCTR  1,0           No, send just the EOL             @SC87275 05719000
  810.          STM   0,1,RIOPRP                                      @SC87275 05720000
  811.          RET                                                   @SC86295 05721000
  812. *                                                                       05722000
  813. TRMPLS   DS    0F            Terminal I/O plists               @SC86295 05723000
  814. * WRTERM Plist during Kermit protocol                                   05724000
  815.          DC    CL8'TYPLIN'                                              05725000
  816.          DC    X'01',AL3(*-*) Send buffer address              @SC86190 05726000
  817.          DC    C'B',X'92'    B=Black,02=No xlate,90=Long       @TB86218 05727000
  818.          DC    H'0'          Buffer length                              05728000
  819. * RDTERM plist during RPACK                                             05729000
  820.          DC    CL8'WAITRD'                                              05730000
  821.          DC    X'01',AL3(*-*) Rcv buffer addr                  @SC86190 05731000
  822.          DC    C'*',C'B'     *:long, B:prompt/direct           @SC87201 05732000
  823.          DC    AL2(0)        Input data length                          05733000
  824. RIOPRP   DC    A(0,1)        Prompt                            @SC87275 05734000
  825.          LOCALS ,                                              @SC86295 05735000
  826.          EXIT                                                           05736000
  827.          TITLE 'SCRNIO Routine - Handle screen I/O via Series/1'        05737000
  828. * R1 points to a pair of (adr,len) for read or write.  If I/O is        05738000
  829. * successfull, R15 returns transferred byte count (else returns -1).    05739000
  830. *               Command code is in R0:                                  05740000
  831. * 0 => Clear screen on console (not comm line)                 @SC90045 05740500
  832. * 1 => Open screen for I/O            4 => Write packet                 05741000
  833. * 2 => Close screen                   5 => Read packet                  05742000
  834. * 3 => Reset screen status after      6 => Write message                05743000
  835. *      environment changes                                              05744000
  836. *                                                                       05745000
  837. * CCW Flags, WCC flag bits, CSW flags:                                  05746000
  838. CC       EQU   X'40'         Command chaining                  @SC86159 05747000
  839. SLI      EQU   X'20'         Suppress Incorr Len Ind                    05748000
  840. ATN      EQU   X'80'         Attention                                  05749000
  841. CE       EQU   X'08'         Channel end                                05750000
  842. DE       EQU   X'04'         Device end                                 05751000
  843. UC       EQU   X'02'         Unit check                                 05752000
  844. UE       EQU   X'01'         Unit exception                             05753000
  845. CPBRK    EQU   ATN+CE+DE+UC  CP break-in                                05754000
  846. *                                                                       05755000
  847. SCRNIO   ENTER                                                          05756000
  848.          LTR   0,0                                             @SC90045 05756100
  849.          BZ    SCRCLR                                          @SC90045 05756200
  850.          STC   0,CONSOPR     Save command code                 @LP88158 05756500
  851.          BCT   0,SCRCLS                                        @SC86295 05757000
  852.          MVC   HNDFNC,HNDPAT+8  Copy function (SET)            @SC88326 05758500
  853.          WAITT ,             Make CMS happy                             05759000
  854.          HOST  HNDINTPL      Issue HNDINT                      @SC86295 05760000
  855.          LA    8,SCRCCWCL    Clear screen now                  @SC86295 05761000
  856.          BAL   9,SCRNEX                                        @SC86295 05762000
  857.          MVI   RIOC,X'80'    Nothing saved                     @SC86295 05763000
  858.          ICM   0,15,LCLDLY                                     @SC87268 05764000
  859.          BZ    RTRN0         Skip extra delay                  @SC87268 05765000
  860.          CPCMD 6,7,'SL 1 SEC' This seems useful                @HF86233 05766000
  861.          B     RTRN0                                           @SC86295 05767000
  862. SCRCLR   CLI   TRMTP,C'T'    Is it a TTY terminal?             @SC90045 05767070
  863.          BE    RTRN0         Yes, can't clear screen           @SC90045 05767140
  864.          CLI   TRMTP,C'V'    Is it a TTY terminal?             @SC90045 05767210
  865.          BE    RTRN0         Yes, can't clear screen           @SC90045 05767280
  866.          TM    FL2,PROTO     In protocol mode?                 @SC90045 05767350
  867.          BO    RTRN0         Yes, skip clearing screen         @SC90045 05767420
  868.          WAITT ,             Wait if necessary                 @SC90045 05767490
  869.          L     1,ADEVTAB     Ptr to device table in nucleus    @SC90045 05767560
  870.          LH    2,0(,1)       CON1 is first device              @SC90045 05767630
  871.          LA    1,SCRCCWCL    Clear-screen CCW                  @SC90045 05767700
  872.          DIAG  1,2,X'58'     Start I/O via diagnose            @SC90045 05767770
  873.          B     RTRN0                                           @SC90045 05767840
  874. SCRCLS   BCT   0,SCRRSET                                       @SC86295 05768000
  875.          LA    8,SCRCCWVM    Release screen                    @SC86295 05769000
  876.          BAL   9,SCRNEX                                        @SC86295 05770000
  877.          MVC   HNDFNC,=C'CLR '                                 @SC88326 05771000
  878.          HOST  HNDINTPL      Issue HNDINT CLR                  @SC88326 05771500
  879.          LA    5,=C'READY ...' Make sure hanging writes appear @SC86159 05772000
  880.          MVC   6(3,5),CONSADH Use console vaddr                @SC86159 05773000
  881.          LA    7,9           String length                     @SC86159 05774000
  882.          CPCMD 5,7,RESP=YES  Suppress reply                    @SC86159 05775000
  883.          B     RTRN0                                           @SC86295 05776000
  884. * (Re)set device characteristics to suit environment                    05777000
  885. SCRRSET  BCT   0,SCRRW                                         @SC86295 05778000
  886.          B     RTRN0                                                    05779000
  887. *                                                                       05780000
  888. *  Perform I/O request                                                  05781000
  889. SCRRW    MVC   SCRCCW,0(1)   Copy adr+len                      @SC88049 05782000
  890.          LR    5,0                                             @SC88049 05782500
  891.          CLC   =C'CON1',HNDDV  Console device?                 @SC89088 05782600
  892.          BE    *+8           Yes, use DIAG 58 facility         @SC89088 05782700
  893.           LA   5,3(,5)       No, use alternate CCW codes       @SC89088 05782800
  894.          IC    9,SCRCCM-1(5) Get command code                  @SC88049 05783000
  895.          STC   9,SCRCCW                                        @SC88049 05783500
  896.          IC    9,SCRCCF-1(5) Get flags                         @SC88049 05784000
  897.          STC   9,SCRCCW+5                                      @SC88049 05784500
  898.          MVI   SCRCCW+4,SLI  Suppress length interrupts        @SC88049 05785000
  899.          CLI   CONSOPR,5     Read operation next?              @SC89180 05785040
  900.          BE    SCRE4TRY      Yes, VTAM will be happy           @SC89180 05785080
  901.          TM    S1INTFL,ATN   Seen attention interrupt lately?  @SC89180 05785120
  902.          BZ    SCRE4TRY      No, VTAM will be happy            @SC89180 05785160
  903.          LA    0,C'a'        Yes, should see what he wants     @SC89180 05785200
  904.          LA    1,CONSXSTA                                      @SC89180 05785240
  905.          LA    2,2                                             @SC89180 05785280
  906.          BAL   7,SCRLOG      Log the interrupt                 @SC89180 05785320
  907.          LA    0,5                                             @SC89180 05785360
  908.          KCALL SCRNIO,SCRRDPL Use recursive call to read       @SC89180 05785400
  909. SCRE4TRY LA    8,SCRCCW                                        @LP88188 05785500
  910.          BAL   9,SCRNEX      Execute internal subr             @SC86295 05787000
  911.          CLI   CONSOPR,5     Was it a packet read?             @LP88188 05788000
  912.          BNE   RTRN          No, continue                      @LP88188 05788080
  913.          LTR   15,15         Did it fail?                      @LP88188 05788160
  914.          BL    RTRN          Yes, continue                     @LP88188 05788240
  915.          TM    FL2,PROTO     In midst of transfer?             @SC88203 05788260
  916.          BZ    RTRN          No, must be status check          @SC88203 05788280
  917.          L     1,0(8)        Data address                      @LP88188 05788320
  918.          CLI   0(1),X'E4'    7171 overrun (line error)?        @LP88188 05788400
  919.          BNE   RTRN          No, continue                      @LP88188 05788480
  920.          LA    8,SCRE4RET    CCWs to reset transparent mode    @LP88188 05788560
  921.          MVI   CONSOPR,4     And send a dummy packet           @LP88188 05788640
  922.          BAL   9,SCRNEX                                        @LP88188 05788720
  923.          MVI   CONSOPR,5     Do the read again                 @LP88188 05788800
  924.          B     SCRE4TRY      Loop until no more E4 reply       @LP88188 05788880
  925. *                                                                       05789000
  926. SCRXCT   ENABLE INTTYPE=NONE      Disable all interrupts       @XN89235 05790000
  927.          CLC   =C'CON1',HNDDV  Console device?                 @SC89088 05790100
  928.          BE    SCRXDIAG      Yes, use DIAG 58 facility         @SC89088 05790200
  929.          AIF   ('&KTAG' NE 'XA').CMSXA2                        @SC90067 05790205
  930.          TM    FLGXA,XACMS   In 370/XA mode?                   @SC89235 05790210
  931.          BZ    SCRXSIO       No, do SIO                        @XN89235 05790220
  932.          MVC   SCRORB+5(2),=X'40FF' Set various flags          @XN89235 05790230
  933.          ST    1,ORBCPA      Set Channel Program Address       @XN89235 05790240
  934.          GETSID DEVICE=(2)   Get subchannel number in R1       @XN89235 05790250
  935.          SSCH  SCRORB        Start the I/O operation           @XN89235 05790260
  936.          BNZ   SCRERR        Error if not CC=0                 @XN89235 05790270
  937.          B     SCRXTSCH      Drain the status                  @XN89235 05790280
  938. SCRXSIO  DS    0H                                              @XN89235 05790290
  939. .CMSXA2  ANOP                                                  @SC90067 05790295
  940.          LR    15,1          Note: R1 clobbered by DMSEXS      @SC89166 05790300
  941.          DMSEXS ST,15,CAW    Use basic SIO                     @SC89166 05790400
  942.          SIO   0(2)                                            @SC89088 05790500
  943.          BNZ   SCRERR        I/O error case                    @XN89235 05790700
  944.          B     SCRXTIO       Drain status                      @XN89235 05790750
  945. SCRXDIAG DIAG  1,2,X'58'     Start I/O via diagnose            @SC89088 05790800
  946.          BNZ   SCRERR        I/O error                         @XN89235 05790900
  947.          AIF   ('&KTAG' NE 'XA').CMSXA3                        @SC90067 05790905
  948.          TM    FLGXA,XACMS   In 370/XA mode?                   @SC89235 05790910
  949.          BZ    SCRXTIO       No, do TIO                        @SC89235 05790920
  950.          GETSID DEVICE=(2)   Get subchannel number in R1       @SC89235 05790930
  951. SCRXTSCH TSCH  SCRSUBAR      Test status of device             @SC89235 05790940
  952.          BC    4,SCRXTSCH    Loop until status pending         @XN89235 05790950
  953.          BC    1,SCRERR      Error if not there now ! (??)     @XN89235 05790960
  954.          MVC   CONSCSW(8),IRBCSW Grab status                   @XN89235 05790970
  955.          B     SCRXTIOO      Rejoin 370 mode                   @SC89235 05790980
  956. .CMSXA3  ANOP                                                  @SC90067 05790985
  957. SCRXTIO  DS    0H                                              @SC89235 05790990
  958.          TIO   0(2)          Test for completion               @SC89088 05791000
  959.          BNZ   *-4           Keep waiting                      @SC89088 05791100
  960.          MVC   CONSCSW(8),CSW    Grab status                   @SC89088 05791200
  961. SCRXTIOO DS    0H                                              @XN89235 05791300
  962.          CLI   CONSOPR,4     Doing a write/read?               @SC89088 05791400
  963.          BNE   SCRXOK        No, we don't need any interrupts  @SC89088 05791500
  964.          TM    CONSUNIT,ATN  Somehow already caught attention? @SC89165 05791600
  965.          BO    SCRXOK        Yes, don't wait at all            @SC89165 05791700
  966.          HOST  HNDWAIT       Wait for I/O to complete          @SC88326 05792000
  967.          OI    CONSUNIT,ATN  Signal attention seen             @SC89088 05792300
  968. SCRXOK   DS    0H                                              @SC89088 05792600
  969.          ENABLE INTTYPE=ALL  Reenable interrupts               @XN89235 05792800
  970.          CLI   CONSCHAN,0                                      @LP88186 05793000
  971.          BNE   SCRERR        Go if ch error                    @LP88186 05794000
  972.          TM    CONSUNIT,X'73' Any unit error?                  @LP88186 05795000
  973.          BNZ   SCRERRC                                         @LP88186 05796000
  974.          LA    0,C'i'        "good interrupt" label            @SC89166 05797000
  975. *        B     SCRLOGI       Log it fall through               @LP88186 05798000
  976. *                                                                       05800000
  977. * SCRLOG: Hexadecimal log of (R2) bytes at address (R1)        @LP88158 05800100
  978. * Log label is taken from R0 low order byte.                   @SC89166 05800200
  979. * Return via R7.  R0-R3 and R15 destroyed.                     @SC89166 05800300
  980. SCRLOGI  DS    0H            Special entry to log interrupts   @LP88158 05800400
  981.          LA    1,CONSCSW                                       @SC89166 05800500
  982.          LA    2,CONSTLEN                                      @LP88158 05800600
  983. SCRLOG   TM    FL1,DEBUG     Logging in effect?                @SC87286 05801000
  984.          BZR   7             No, that's all                    @SC89166 05802000
  985.          TM    DBGFLG,DBGIO  I/O stuff requested?              @SC88168 05802300
  986.          BZR   7             No, skip it                       @SC89166 05802600
  987.          L     3,LOGBUF      Ptr to buffer                     @LP88158 05802900
  988.          STC   0,0(,3)       Set log label                     @SC89166 05803000
  989.          LA    0,6*9+2(3)    End of line buffer                @SC88168 05803200
  990.          LA    3,2(3)        Start of data area                @LP88158 05803800
  991. SCRLOGLP MVI   0(3),C' '     Add for readability               @LP88158 05804100
  992.          UNPK  1(9,3),0(5,1) Unpack into buffer                @SC88168 05804400
  993.          TR    1(8,3),TRHEX  Convert to printable hex          @SC88168 05804700
  994.          LA    3,9(3)        Advance text ptr                  @SC88168 05805000
  995.          LA    1,4(1)        and data source                   @LP88158 05805300
  996.          S     2,F4          Finished data?                    @SC88168 05805600
  997.          BNP   SCRLGEND      Yes, go write                     @LP88158 05805900
  998.          CR    3,0           Reached text limit?               @LP88158 05806200
  999.          BL    SCRLOGLP      no, loop for more slices          @LP88158 05806500
  1000.          MVC   0(3,3),=C'...' Show incomplete                  @LP88158 05806800
  1001.          LA    3,3(3)                                          @SC88168 05807100
  1002. SCRLGEND DS    0H                                              @LP88158 05807400
  1003.          AR    2,2           Check for incomplete slice        @SC88168 05807700
  1004.          BNM   *+6           No, ok                            @SC88168 05808000
  1005.          AR    3,2           Yes, adjust end of text           @SC88168 05808300
  1006.          S     3,LOGBUF      Get length of text                @SC88168 05808600
  1007.          WRITF LOGPTR,BSIZE=(3) Log it                         @LP88158 05808900
  1008.          TM    DBGFLG,DBGSV  SAVE requested?                   @SC88168 05809200
  1009.          BZR   7             No, skip closing log file         @SC89166 05809500
  1010.          SAVEF LOGPTR        Update disk directory             @SC88168 05809800
  1011.          BR    7                                               @SC89166 05810100
  1012. *                                                                       05811000
  1013. SCRNEX   LA    4,10          CP BREAKIN recovery retry count   @LP88186 05812000
  1014.          NI    S1INTFL,255-ATN Clear pending attention, if any @SC89180 05812050
  1015. SCRDIAG  LR    1,8           Get CCW ptr                       @LP88186 05812100
  1016.          SLR   2,2           Convert op. code to log label     @LP88158 05812200
  1017.          IC    2,CONSOPR                                       @LP88158 05812300
  1018.          LA    2,CONSOPRS(2)                                   @LP88158 05812400
  1019.          IC    0,0(,2)                                         @SC89166 05812500
  1020.          LA    2,8           Size of one CCW                   @LP88158 05812600
  1021.          TM    4(1),CC       Command chained?                  @LP88158 05812700
  1022.          BZ    *+8                                             @LP88158 05812800
  1023.          LA    2,8(2)        Yes, add another                  @LP88158 05812900
  1024.          BAL   7,SCRLOG      CCWs logged                       @SC89166 05813000
  1025.          LH    2,CONSADDR            Console address                    05814000
  1026.          AIF   ('&KTAG' NE 'XA').CMSXA4                        @SC90067 05814050
  1027.          TM    FLGXA,XACMS   In 370/XA mode?                   @SC89235 05814100
  1028.          BZ    SCRTIO        No, do TIO                        @SC89235 05814200
  1029.          GETSID DEVICE=(2)   Get subchannel number in R1       @XN89235 05814300
  1030. SCRTSCH  TSCH  SCRSUBAR      Test status of console            @XN89235 05814400
  1031.          BZ    SCRTSCH       Loop if status stored             @XN89235 05814500
  1032.          B     SCRTIOO       Rejoin 370 mode                   @SC89235 05814600
  1033. SCRTIO   DS    0H                                              @SC89235 05814700
  1034. .CMSXA4  ANOP                                                  @SC90067 05814800
  1035.          TIO   0(2)                  See if usable                      05815000
  1036.          BC    6,*-4                 Loop if busy or CSW stored         05816000
  1037. SCRTIOO  DS    0H                                              @SC89235 05816500
  1038.          BC    1,SCRERR              not operational: error             05817000
  1039.          LR    1,8           Copy CCW adr                      @SC89088 05818000
  1040.          BAL   7,SCRXCT      Execute and wait for completion   @SC89166 05819000
  1041.          LH    5,6(8)        Buffer size                       @LP88186 05820800
  1042.          SH    5,CONSBYTC    Minus residual count              @LP88186 05821600
  1043.          L     1,0(8)        Data address                      @LP88186 05822400
  1044.          LA    0,C'd'        "Data" label                      @SC89166 05823200
  1045.          LR    2,5           Data size                         @LP88186 05824000
  1046.          BAL   7,SCRLOG                                        @SC89166 05824800
  1047.          LR    15,5                                            @LP88186 05825600
  1048.          TM    0(8),1        Is it a channel read?             @LP88186 05826400
  1049.          BOR   9             No, size OK                       @LP88186 05827200
  1050.          S     15,F3         Deduct 3 for buffer adr           @LP88186 05828000
  1051.          BNLR  9                                               @LP88186 05828800
  1052.          SLR   15,15                                           @LP88186 05829600
  1053.          BR    9             Return to caller                  @LP88186 05830400
  1054. *                                                                       05831200
  1055. SCRERRC  DS    0H            Fatal I/O error                   @LP88186 05832000
  1056.          LA    0,C'e'        Indicate error interrupt or CC    @SC89166 05832800
  1057.          BAL   7,SCRLOGI     Log it                            @SC89166 05833600
  1058.          CLI   CONSUNIT,CPBRK CP stole the screen?             @SC89088 05834400
  1059.          BNE   SCRERR        Bin                               @LP88186 05835200
  1060.          BCT   4,SCRBRK      Go recover unless retries exhaust @LP88186 05836000
  1061. SCRERR   SR    15,15                                           @SC86295 05839000
  1062.          BCTR  15,0          Return error code of -1           @SC86295 05840000
  1063.          ENABLE INTTYPE=ALL  Reenable interrupts               @XN89235 05840500
  1064.          BR    9                                               @SC86295 05841000
  1065. SCRBRK   DS    0H            CP BREAKIN recovery               @LP88186 05842000
  1066.          LA    1,RTRYIO                                        @LP88186 05842500
  1067.          LA    0,C'b'        Log BREAKIN recovery CCW          @SC89166 05843000
  1068.          LA    2,16                                            @LP88186 05843500
  1069.          BAL   7,SCRLOG                                        @SC89166 05844000
  1070.          LA    14,=C'RESET ...'                                @LP88186 05844500
  1071.          MVC   6(3,14),CONSADH Use console vaddr               @LP88186 05845000
  1072.          LA    0,9           String length                     @LP88186 05845500
  1073.          CPCMD 14,0,RESP=YES Reply to buffer                   @LP88186 05846000
  1074.          LA    1,RTRYIO                                        @LP88186 05846500
  1075.          LH    2,CONSADDR    Console address                   @LP88186 05847000
  1076.          OI    CONSOPR,X'80' Flag to avoid waiting for ATTN    @LP88186 05850990
  1077.          BAL   7,SCRXCT      Take the screen back              @SC89166 05852000
  1078.          NI    CONSOPR,X'7F' Restore as request                @LP88186 05852970
  1079.          B     SCRDIAG       Try again                         @SC86159 05856000
  1080.          DS    0D                                                       05857000
  1081. SCRCCWCL DC    X'19',AL3(0),AL1(SLI),X'FF',AL2(1)                       05858000
  1082. SCRCCWVM DC    X'19',AL3(0),AL1(SLI),X'FE',AL2(1)                       05859000
  1083. *                                                                       05860000
  1084. RTRYIO   DC    0D'0',X'19',AL3(0),AL1(CC+SLI),X'FF',AL2(1)     @SC86159 05865000
  1085.          DC    X'29',AL3(RTRYCM),AL1(SLI),X'90',AL2(1)         @TB88078 05866000
  1086. RTRYCM   DC    X'&S1CMD'                                       @LP88187 05867000
  1087. *                                                                       05867200
  1088. SCRE4RET DS    0D                                              @LP88188 05867220
  1089.          DC    X'29',AL3(SCRE4LTM),AL1(SLI+CC),X'90',Y(SCRE4LTL) P88168 05867240
  1090.          DC    X'29',AL3(SCRE4DWR),AL1(SLI),X'00',Y(SCRE4DWL)  @SC88168 05867260
  1091. SCRE4LTM DC    X'40',AL1(SBA),X'4040',AL1(ICR),X'4040' Reset   @SC88168 05867280
  1092. SCRE4LTL EQU   *-SCRE4LTM    Length of command                 @SC88168 05867300
  1093. SCRE4DWR DC    X'C2',AL1(SBA),X'5D7F',AL1(SBA),X'000180' packet@SC88168 05867320
  1094. SCRE4DWL EQU   *-SCRE4DWR    Length of command                 @SC88168 05867340
  1095. *              -DIAG58- --SIO---                               @SC89268 05867400
  1096. *              W  R  WM W  R  WM    CCW's for send, recv, msg  @SC89268 05867500
  1097. SCRCCM   HTBL  29,2A,29,01,06,05   Command codes               @SC89268 05867600
  1098. SCRCCF   HTBL  00,80,90,00,00,00   Extra flags                 @SC89268 05867700
  1099. *        Use x'10' flag in the writemsg CCW flag byte to       @TB88078 05867830
  1100. *        prohibit VM/XA DIAG58 from issuing Read Modifieds     @TB88078 05867860
  1101. *        to check for PA1                                      @TB88078 05867890
  1102.          TITLE 'SETMSG Routine - controls CP breakin'                   05868000
  1103. * Entry: R1 selects operation                                           05869000
  1104. * Exit: R15=0 if ok                                                     05870000
  1105. * 1-> Analyze user environment, determine if suitable.                  05871000
  1106. *     Save quantities needed and condition line for entering commands.  05872000
  1107. *     Perform any system-dependent initialization.                      05873000
  1108. * 2-> Condition line for protocol transfers.                            05874000
  1109. * 3-> Decondition line at end of transfer.                              05875000
  1110. * 4-> System-dependent clean-up at exit.                                05876000
  1111. * 5-> Reperform system-dependent initialization after SET LINE.         05877000
  1112. SETMSG   ENTER ALT                                             @SC86295 05878000
  1113.          BCT   1,STM2                Go if R1 not 1, so no init         05879000
  1114.          L     1,ORGR1                                         @SC88049 05880000
  1115.          MVC   KRMNAM,0(1)   Copy original invoked name        @SC88049 05880200
  1116.          L     2,CBUF        Put diag result here                       05880400
  1117.          LA    3,32          Get this much info                         05881000
  1118.          DIAG  2,3,X'00'     Identify                                   05882000
  1119.          MVC   USRTAKE,16(2) Move userid to our buffer                  05883000
  1120.          MVC   HNDINTPL(LHNDWT),HNDPAT Init HNDINT             @SC88326 05883500
  1121.          L     1,ASTMUSET                                      @SC87117 05884000
  1122.          MVC   8(9,1),=C'MACHINE -'                            @SC89235 05885000
  1123.          CPCMD 2,4,'Q SET',RESP=YES                            @SC86148 05886000
  1124.          MVC   ADR,CBUF              Response address for parser        05887000
  1125.          ST    5,LEN                 Response length for parser         05888000
  1126.          MVC   STMSCNS(8),SCANPTR Save string ptrs             @SC89235 05889000
  1127.          SR    5,5           Length of previous data           @SC89235 05889050
  1128.          LA    8,STMMLEN-2   Descriptor list for MACHINE       @SC89235 05889100
  1129.          BAL   2,STMGET                                        @SC89235 05889150
  1130.          L     1,ASTMUSET                                      @SC89235 05889200
  1131.          CLI   8+8(1),C'-'   Is it VM/XA?                      @SC89235 05889250
  1132.          BE    STMVMSP       No, remember that                 @SC89235 05889300
  1133.          OI    FLGXA,XACP    CP is VM/XA                       @SC89235 05889350
  1134.          CLI   8+8(1),C'3'   Is it in 370 mode?                @SC89235 05889400
  1135.          BE    STMVMSP       Yes, remember that                @SC89235 05889450
  1136.          OI    FLGXA,XACMS   CMS is in XA mode                 @SC89235 05889500
  1137.          WRTERM 'This is a non-XA Kermit: set machine 370'     @SC89235 05889510
  1138.          B     RTRN1         Too bad, give up                  @SC89235 05889520
  1139. STMVMSP  DS    0H                                              @SC89235 05889550
  1140.          MVC   0(STMUL+STMLL,1),STMUOFF Set up pattern         @SC87117 05889600
  1141.          S     1,F4          Start of list: back 8, up L'SET +1@SC87117 05890000
  1142.          SR    5,5           Length of previous data           @SC86148 05891000
  1143.          LA    8,STMLEN-2    Descriptor list                   @SC86148 05892000
  1144.          MVC   SCANPTR(8),STMSCNS Restore ptrs                 @SC89235 05893000
  1145.          BAL   2,STMGET                                        @SC89235 05893200
  1146.          BAL   2,STMGET                                        @SC89235 05893400
  1147.          MVC   SCANPTR(8),STMSCNS Restore ptrs again           @SC89235 05893600
  1148.          LA    4,5           Number of items in QUERY SET      @SC89235 05893800
  1149.          BAL   2,STMGET                                        @SC86295 05894000
  1150.          BCT   4,*-4                                           @SC86148 05895000
  1151.          CPCMD 2,6,'Q TERM',RESP=YES                           @SC86148 05898000
  1152.          MVC   ADR,CBUF              Response address for parser        05899000
  1153.          ST    7,LEN         Response length for parser        @SC87117 05900000
  1154.          LA    1,1(1)        One extra: L'TERM - L'SET         @SC87117 05901000
  1155.          BAL   2,STMGET                                        @SC86295 05902000
  1156.          BAL   2,STMGET      (if more: put S 1,F4 in loop)     @SC87295 05903000
  1157. *          Note: KWRKBASE is 11...                             @SC89268 05903500
  1158.          STM   10,11,STMSAVR Save base registers               @SC87117 05904000
  1159.          HOST  STMEXC        Set up subcommand environment     @SC87117 05905000
  1160.          B     STM5X                                           @SC87351 05906000
  1161.          DS    0F                                              @SC87117 05907000
  1162. STMEXC   DC    CL8'SUBCOM',CL8'KERMIT'                         @SC87117 05908000
  1163.          DC    F'0',A(STMSUBC,0)                               @SC87117 05909000
  1164. *                                                                       05910000
  1165. STM2     BCT   1,STM3                Go if R1 was not 2, so not off     05911000
  1166.          TM    FL1,TSTF                                        @SC86295 05912000
  1167.          BO    RTRN0         Just testing, don't change it     @SC86295 05913000
  1168.          LA    2,STMUOFF             Set everything off                 05916000
  1169.          MVC   STMUOTB,AOUTRTBL Save user's table ptrs         @SC87201 05917000
  1170.          MVC   STMUITB,AINTRTBL                                @SC87201 05918000
  1171.          LA    7,F0          Set to turn off translation       @SC87201 05919000
  1172.          LR    8,7                                             @SC87201 05920000
  1173.          B     STMD                                                     05921000
  1174. *                                                                       05922000
  1175. STM3     BCT   1,STM4                                          @SC86316 05923000
  1176.          L     2,ASTMUSET    Restore user's settings           @SC87117 05924000
  1177.          LA    7,STMUITB     Restore user's table ptrs         @SC87201 05925000
  1178.          LA    8,STMUOTB                                       @SC87201 05926000
  1179. STMD     LA    4,STMUL       Length of 1st batch               @SC87117 05927000
  1180.          LA    5,0(2,4)      Start of 2nd                      @SC87117 05928000
  1181.          LA    6,STMSPL      Length of VM/SP-only stuff        @SC89235 05928100
  1182.          TM    FLGXA,XACP    Is it VM/SP?                      @SC89235 05928200
  1183.          BZ    *+8                                             @SC89235 05928300
  1184.           AR   2,6           No, skip that stuff               @SC89235 05928400
  1185.           SR   4,6                                             @SC89235 05928500
  1186.          CPCMD 2,4           Issue a bunch of CP commands      @SC87117 05929000
  1187.          CLI   TRMTP,C'V'    FULLSCREEN mode?                  @SC89020 05929300
  1188.          BE    *+12          No, do linemode stuff             @SC89020 05929600
  1189.          CLI   TRMTP,C'T'    Fullscreen mode?                  @SC87166 05930000
  1190.          BNE   RTRN0         Yes, skip linemode stuff          @CR86321 05931000
  1191.          DMSEXS MVC,AINTRTBL,0(7)   Restore input table        @SC87201 05932000
  1192.          DMSEXS MVC,AOUTRTBL,0(8)   Restore output table       @SC87201 05933000
  1193.          LA    7,STMLL                                         @SC87295 05934000
  1194.          CPCMD 5,7,RESP=YES  No, do linemode stuff             @SC87295 05935000
  1195.          B     RTRN0                                                    05936000
  1196. *                                                                       05937000
  1197. STM4     BCT   1,STM5        Special clean-up                  @SC87351 05938000
  1198.          B     RTRN0         Special clean-up not needed       @SC87351 05939000
  1199. *                                                                       05940000
  1200. STM5     DS    0H            Re-init after SET LINE            @SC87351 05941000
  1201. STM5X    SR    2,2                                             @SC86295 05942000
  1202.          BCTR  2,0                                             @SC86295 05943000
  1203.          CLI   TRMLIN,C' '   External line?                    @SC87351 05944000
  1204.          BE    STM5D         No, use console                   @SC87351 05945000
  1205.          TR    TRMLIN,UPCASE                                   @SC88120 05945500
  1206.          LA    5,3+1         Allow no more than 3 hex digits   @SC87351 05946000
  1207.          SR    2,2           Init value                        @SC87351 05947000
  1208.          LA    1,TRMLIN      Ptr to string                     @SC87351 05948000
  1209. STM5L    CLI   0(1),C' '     Look for end of value             @SC87351 05949000
  1210.          BE    STM5D         Ok, got number                    @SC87351 05950000
  1211.          IC    3,0(1)                                          @SC87351 05951000
  1212.          CLI   0(1),C'0'     0-9?                              @SC87351 05952000
  1213.          BL    STM5LA                                          @SC87351 05953000
  1214.          CLI   0(1),C'9'                                       @SC87351 05954000
  1215.          BH    RTRN1         Bad digit                         @SC87351 05955000
  1216.          B     STM5LS        Ok, use it                        @SC87351 05956000
  1217. STM5LA   CLI   0(1),C'A'     A-F?                              @SC87351 05957000
  1218.          BL    RTRN1         Bad                               @SC87351 05958000
  1219.          CLI   0(1),C'F'                                       @SC87351 05959000
  1220.          BH    RTRN1         Bad                               @SC87351 05960000
  1221.          LA    3,9(3)        OK, get in binary                 @SC87351 05961000
  1222. STM5LS   SLL   3,28          Convert to nybble                 @SC87351 05962000
  1223.          SLDL  2,4                                             @SC87351 05963000
  1224.          LA    1,1(1)        Keep scanning                     @SC88049 05963500
  1225.          BCT   5,STM5L                                         @SC87351 05964000
  1226.          B     RTRN1         String too long                   @SC87351 05965000
  1227. STM5D    DIAG  2,3,X'0024'   Get console flags                          05966000
  1228.          BO    RTRN1         Bad device(?)                     @SC87351 05967000
  1229.          CLM   3,8,=X'40'    Is it a dedicated GRAF dev?       @SC88203 05967300
  1230.          BE    *+12          Yes, ok                           @SC88203 05967600
  1231.          CLM   3,8,=X'8020'  Is this a terminal?               @SC87351 05968000
  1232.          BNE   RTRN1         No, bad device                    @SC87351 05969000
  1233.          MVI   TRMTP,C'&KCONT'  1st assume TTY                 @SC88309 05969500
  1234.          STH   2,CONSADDR    Save console addr (CUU)                    05970000
  1235.          UNPK  CONSADH(4),CONSADDR(3)                          @SC86159 05971000
  1236.          TR    CONSADH(3),TRHEX  Save as chars                 @SC86159 05972000
  1237.          L     5,ADEVTAB     Ptr to system device table        @SC88326 05972100
  1238.          LA    6,DEVSIZE     Size of table item                @SC88326 05972200
  1239.          L     7,ATABEND     End of table                      @SC88326 05972300
  1240.          CLM   2,3,0(5)      Check device vaddr                @SC89235 05972400
  1241.          BE    STM5HL        Found it, use this name           @SC88326 05972500
  1242.          BXLE  5,6,*-8                                         @SC88326 05972600
  1243.          LA    5,HNDPATDV-4  Not found, use default name       @SC88326 05972700
  1244. STM5HL   MVC   HNDDV,4(5)                                      @SC88326 05972800
  1245.          MVC   WAITDV,4(5)                                     @SC88326 05972900
  1246.          CLM   4,12,=X'8020' Is this a TTY?                    @SC86295 05973000
  1247.          BE    RTRN0         Yes, all set                      @SC88203 05974000
  1248.          MVI   TRMTP,C'S'    Remember going via S/1            @SC87166 05975000
  1249.          L     8,S1RDPL                                        @SC88203 05975050
  1250.          XC    0(9,8),0(8)   Zero out buffer                   @SC88203 05975100
  1251.          LA    0,1                                             @SC88203 05975150
  1252.          KCALL SCRNIO        Clear screen and set up           @SC88203 05975200
  1253.          LA    0,6                                             @SC88203 05975250
  1254.          KCALL SCRNIO,STMS1ST Issue status request             @SC88203 05975300
  1255.          LA    0,5                                             @SC88203 05975350
  1256.          KCALL SCRNIO,S1RDPL Read back status                  @SC88203 05975400
  1257.          LA    0,2                                             @SC88203 05975450
  1258.          KCALL SCRNIO        Release screen                    @SC88203 05975500
  1259.          CLI   0(8),X'E4'    Check for Yale status response    @SC88203 05975550
  1260.          BE    *+12          Ok, I trust                       @SC88294 05975600
  1261.           CLI  0(8),0        Other possibility                 @SC88294 05975610
  1262.           BNE  STMGRP        No, must be something else        @SC88294 05975620
  1263.          CLI   3(8),X'11'                                      @SC88203 05975650
  1264.          BNE   STMGRP        No, must be something else        @SC88203 05975700
  1265.          CLC   =X'2B5B5B',6(8)                                 @SC88203 05975750
  1266.          BE    RTRN0         Yes, all set                      @SC88203 05975800
  1267. STMGRP   MVI   TRMTP,C'G'    Assume graphics device            @SC88203 05975850
  1268.          B     RTRN0                                                    05976000
  1269. *                                                                       05977000
  1270. * Parse CP response for token pointed by R1:  <len-1> token             05978000
  1271. * On entry:    R1 = ptr-8-R5 of name in user list              @SC86148 05979000
  1272. *              R5 = length of previous token                   @SC86148 05980000
  1273. *              R8 = ptr to previous len-1 of name,data         @SC86148 05981000
  1274. * On exit:     R1,R5,R8 updated                                @SC86148 05982000
  1275. *              value copied into user list                     @SC86148 05983000
  1276. *                                                                       05984000
  1277. STMGET   LA    8,2(8)        Point to next descriptor          @SC86148 05985000
  1278.          LA    1,8(5,1)      Advance to next name              @SC86148 05986000
  1279.          IC    5,1(8)        Get length of data                @SC86148 05987000
  1280. STMGET1  NTOKN N=0(2)        Pick next token                   @SC86295 05988000
  1281.          CLM   7,1,0(8)      Is this the same size we want?    @SC86148 05989000
  1282.          BNE   STMGET1       Not the size we want              @SC86148 05990000
  1283.          EX    7,STMGETC             is it right one?                   05991000
  1284.          BNE   STMGET1       Nope, keep on looking             @SC86148 05992000
  1285.          AR    1,7           Space over name                   @SC86148 05993000
  1286.          NTOKN N=0(2)        Use the next token                @SC86316 05994000
  1287.          EX    5,STMGETM     Copy value                        @SC86148 05995000
  1288.          BR    2                                               @SC86295 05996000
  1289. *                                                                       05997000
  1290. STMGETC  CLC   0(,1),0(6)    Check token against list          @SC86148 05998000
  1291. STMGETM  MVC   2(,1),0(6)    Save value in list                @SC86148 05999000
  1292. *                                                                       06000000
  1293. *                  ACNT TIME                         -- SET    @SC89235 06001000
  1294. STMLEN   DC    AL1(03,2,04,3)                                  @SC89235 06001300
  1295. *                  MSG  WNG  RUN  EDIT IMSG          -- SET    @SC89235 06001600
  1296.          DC    AL1(02,3,02,3,02,2,06,2,03,3)                   @SC89235 06001900
  1297. *                  SIZE SCRL                         -- TERM   @SC89235 06002200
  1298.          DC    AL1(07,2,05,3)                                  @SC89235 06002500
  1299. *                                                                       06003000
  1300. STMUOFF  EQU   *       Start of CP commands to set all off     @SC89235 06004000
  1301.          DC    C'SET ACNT OFF',X'15'                           @SC89235 06004200
  1302.          DC    C'SET TIMER OFF ',X'15'                         @SC89235 06004400
  1303. STMSPL   EQU   *-STMUOFF     Amount to skip if VM/XA           @SC89235 06004600
  1304.          DC    C'SET MSG OFF ',X'15'                           @SC89235 06004800
  1305.          DC    C'SET WNG OFF ',X'15' (in order of CP msgs)              06005000
  1306.          DC    C'SET RUN ON ',X'15'                                     06007000
  1307.          DC    C'SET LINEDIT OFF',X'15'                        @SC88194 06007500
  1308.          DC    C'SET IMSG OFF ',X'15'                          @SC87117 06009000
  1309. STMUL    EQU   *-STMUOFF                                       @CR86321 06010000
  1310. STMLOFF  DC    C'TERM LINESIZE OFF'                            @CR86321 06012000
  1311.          DC    CL5' ',C'SCROLL CONT'  (if more, cut to 1 sp)   @SC87295 06013000
  1312. STMLL    EQU   *-STMUOFF-STMUL                                 @SC87117 06014000
  1313. STMMLEN  DC    AL1(06,2)     Descriptor for MACHINE            @SC89235 06014500
  1314.          TITLE 'STMSUBC Routine - subcommand environment handler'       06015000
  1315.          USING STMSUBC,15                                      @SC87117 06016000
  1316. STMSUBC  STM   14,12,12(13)  Save registers                    @SC87117 06017000
  1317.          LM    10,11,STMSAVR Get base registers                @SC87117 06018000
  1318.          LA    0,USNTRFLX    Length of locals                  @SC87117 06019000
  1319.          BAL   14,SUBENT     Set up entry                      @SC87117 06020000
  1320.          LR    15,KSUBBASE   Recover local base register       @SC89268 06021000
  1321.          LR    2,0           Save ptr to EPLIST                @SC87117 06022000
  1322.          LA    0,RTRNUM      Set to return error code          @SC87117 06023000
  1323.          L     1,=A(USNCMDX) All commands but QUIT             @SC87117 06024000
  1324.          BAL   14,LOOPS                                        @SC87117 06025000
  1325.          L     KSUBBASE,=A(USNTRF) Ptr to main loop routine    @SC89268 06026000
  1326.          LM    15,0,4(2)     Ptrs to command and end           @SC87117 06027000
  1327.          SR    0,15          Get length                        @SC87117 06028000
  1328.          LA    1,CMD                                           @SC87117 06029000
  1329.          MVC   0(256,1),0(15) Copy to buffer                   @SC87117 06030000
  1330.          OI    KFLG-USNTRFSV(13),CMDC+SIGN Indicate just 1 cmd @SC87117 06031000
  1331.          B     LUPPRS                                          @SC87117 06032000
  1332.          TITLE 'S1INT Routine - interrupt handler'                      06034000
  1333.          USING S1INT,15                                        @SC86295 06035000
  1334. S1INT    DS    0H                                              @SC89088 06036000
  1335.          STCM  3,12,CONSXSTA Save status bytes                 @SC89180 06037000
  1336.          TM    CONSXSTA,ATN  Attention received?               @SC89180 06038000
  1337.          BZ    S1IOK         No, forget it                     @SC89180 06039000
  1338.          OI    S1INTFL,ATN   Yes, remember it                  @SC89180 06040000
  1339. S1IOK    SR    15,15         R15=0-> intrpt proc complete               06041000
  1340.          BR    14                                              @SC86295 06042000
  1341.          DROP  15                                              @SC86295 06043000
  1342. *                                                                       06044000
  1343. * HNDINT Plist for Series/1 interrupt handling                          06045000
  1344. HNDPAT   DC    CL8'HNDINT'   HNDINT plist                      @SC88326 06046000
  1345.          DC    CL4'SET'      Set function                               06047000
  1346. HNDPATDV DC    CL4'CONK'     Symbolic device (or CON1)         @SC88326 06048000
  1347.          DC    AL4(S1INT)    S1 Interrupt handler                       06049000
  1348.          DC    AL2(9)        Console address (fill in)         @SC88326 06050000
  1349.          DC    CL2'WC'                                                  06051000
  1350.          DC    4X'FF'                                          @SC88326 06052000
  1351.          DC    CL8'WAIT'                                       @SC88326 06052050
  1352. LHNDWT   EQU   *-HNDPAT                                        @SC88326 06052100
  1353. *                                                                       06052200
  1354. STMS1ST  DC    A(STMS1ORD,L'STMS1ORD)                          @SC88203 06052400
  1355. STMS1ORD DC    X'C32B5BBC'   WCC + Yale ASCII status request   @SC88203 06052600
  1356. *                                                                       06053000
  1357. CONSCSW  DS    A             (key + cc)(1) + CCW addr(3)                06054000
  1358. CONSUNIT DS    X             Unit status                                06055000
  1359. CONSCHAN DS    X             Channel status                             06056000
  1360. CONSBYTC DS    H             Byte count                                 06057000
  1361. CONSTLEN EQU   *-CONSCSW     End of console status log area    @LP88158 06057300
  1362. *                                                                       06057310
  1363. SCRRDPL  DC    A(SCRSENSE,L'SCRSENSE)                          @SC89180 06057320
  1364. SCRSENSE DS    XL10          Buffer for ATN-triggered read     @SC89180 06057330
  1365. CONSXSTA DS    XL2           Status bytes saved on interrupt   @SC89180 06057340
  1366. S1INTFL  DS    X             Saved interrupt flags             @SC89180 06057350
  1367. *                                                                       06057400
  1368. CONSOPRS DC    C'?ocswrm'    Console commands labels for log   @LP88186 06057500
  1369. STMSAVR  DS    2F                                              @SC88168 06057600
  1370. CONSADH  DC    C'...',C' '   Unpacked vaddr + pad              @SC86159 06058000
  1371.          LOCALS ,                                              @SC86295 06059000
  1372. SCRCCW   DS    D             CCW for send, recv, msg           @SC88049 06059500
  1373. STMSCNS  DS    2F            Saved scan ptrs                   @SC87117 06060000
  1374.          AIF   ('&KTAG' NE 'XA').CMSXA5                        @SC90067 06060050
  1375. SCRORB   DS    F'0'          Parameter=0                       @XN89235 06060100
  1376.          DS    X'00,40,FF,00'   Key=0, etc.                    @XN89235 06060200
  1377. ORBCPA   DS    A             Address is filled in              @XN89235 06060300
  1378. SCRSUBAR DS    16F           Storage for TSCH                  @XN89235 06060400
  1379. IRBCSW   EQU   SCRSUBAR+4,8                                    @XN89235 06060500
  1380. .CMSXA5  ANOP                                                  @SC90067 06060600
  1381. CONSOPR  DS    XL1           Current I/O operation             @SC89180 06060800
  1382. SETMSG   EXIT                                                           06061000
  1383.          TITLE 'DISKIO Routine - performs disk I/O functions'           06062000
  1384. * ERRNUM unchanged unless there is a disk error.                        06062500
  1385. * Function selected on entry by R0:                                     06063000
  1386. * 0=> unnum: R1->FAB.  Return R1->buffer,R0=# and remove the sequence   06063300
  1387. *   number (if any) from the buffer (used for TAKE files)               06063600
  1388. * 1=> open (in): R1->pattern FDB, R2->name.  Returns R0->FAB, R1->FDB   06064000
  1389. * 2=> open (out): (same)                                                06065000
  1390. * 3=> test name: R2->name.  Returns R1->FDB if found (else R15=1)       06066000
  1391. * 4=> close file: R1->adr(FAB).                                         06067000
  1392. * 5=> set up search: R1->pattern name.                                  06068000
  1393. * 6=> return next file in list:  Returns R1->FDB + sets up FILNAM       06069000
  1394. * 7=> close search (if any).                                            06070000
  1395. * 8=> test CWD string: R1->string.  Returns R15=0 if ok, else =1.       06071000
  1396. * 9=> read: R1->FAB.  Returns R15=12 if EOF, 0 if ok; R0=# data         06072000
  1397. * 10=> write: R1->FAB.  Returns R15=13 if disk full, 0 if ok.           06073000
  1398. * 11=> test space: R1->pattern FDB (has size in Kbytes),                06074000
  1399. *  R2->name (used if FAB not found), R6->adr(FAB). Return R15=0 if ok.  06074500
  1400. * 12=> analyze R/W error, set ERRNUM, make EMSG: R1->FAB, TMPDW=code    06075000
  1401. *      always returns R15=1                                             06076000
  1402. * 13=> directory info on file: R1->name.  Returns R15=0 if ok.          06077000
  1403. * 14=> delete file: R1->name.  Returns R15=0 if ok.                     06078000
  1404. * 15=> rename file: R1->name, R2->new name.  Returns R15=0 if ok.       06079000
  1405. * 16=> copy file: R1->name, R2->new name.  Returns R15=0 if ok.         06080000
  1406. * 21=> save file status in directory: R1->FAB. (not used)      @SC88168 06080200
  1407. * 22=> open library (in): R2->DDNAME.  Return R15=0 if ok.     @SC89073 06080400
  1408. * 23=> point for next read, R1->adr(FDB), R2=records to skip.  @SC89218 06080600
  1409. *      Return R15=0 if ok.                                     @SC89218 06080800
  1410. DISKIO   ENTER                                                          06081000
  1411.          USING FABD,3                                          @SC86295 06082000
  1412.          SR    4,4           Signal no block assigned          @SC86295 06083000
  1413.          LR    5,0                                             @SC89073 06083010
  1414.          AR    5,5                                             @SC89073 06083020
  1415.          LH    5,DSK0(5)     Get handler address               @SC89073 06083030
  1416.          B     DSK0(5)       Do the function                   @SC89073 06083040
  1417. DSK0     DC    Y(DSKNON-DSK0,DSKOPNI-DSK0,DSKOPNO-DSK0)   0-2  @SC89073 06083050
  1418.          DC    Y(DSKTEST-DSK0,DSKCLOS-DSK0,DSKNSET-DSK0)  3-5  @SC89073 06083060
  1419.          DC    Y(DSKNXT-DSK0,DSKNSX-DSK0,DSKCWDF-DSK0)    6-8  @SC89073 06083070
  1420.          DC    Y(DSKER1-DSK0,DSKER1-DSK0,DSKTSP-DSK0)     9-11 @SC89073 06083080
  1421.          DC    Y(DSKXXX-DSK0),8Y(DSKUTL-DSK0)            12-20 @SC89073 06083090
  1422.          DC    2Y(DSKER1-DSK0),Y(DSKPNT-DSK0)            21-23 @SC89218 06083100
  1423.          DC    8Y(DSKER1-DSK0)   Spares                        @SC89073 06083110
  1424. *                                                                       06083120
  1425. DSKNON   DS    0H                                              @SC89073 06083130
  1426.          LR    3,1           Address FAB                       @SC88101 06083150
  1427.          L     0,FABNORD     Get length of buffer              @SC88101 06083200
  1428.          L     2,FDBBUFF     Get ptr to buffer                 @SC88101 06083250
  1429.          CLI   FDBRCF,C'F'   Fixed-length records?             @SC88101 06083300
  1430.          BNE   DSKNONZ       No, no line numbers               @SC88101 06083350
  1431.          CH    0,=H'80'      See if F/80                       @SC88101 06083400
  1432.          BNE   DSKNONZ       No                                @SC88101 06083450
  1433.          MVZ   WLDPAT(5),75(2)  See if 76-80 are all numeric   @SC88101 06083500
  1434.          CLC   WLDPAT(5),=5C'0'                                @SC88101 06083550
  1435.          BNE   DSKNONZ       No                                @SC88101 06083600
  1436.          S     0,F8          Yes, move the end back            @SC88101 06083650
  1437. DSKNONZ  RETREG 0,(1,2)      Return R0 and (2) as R1           @SC88218 06083700
  1438.          B     RTRN0         Done                              @SC88101 06083800
  1439. DSKOPNI  DS    0H                                              @SC88101 06083850
  1440. *                                                                       06085000
  1441. * Open for input file whose name is at (R2), FDB at (R1)                06086000
  1442.          BAL   9,DSKALC      Get FAB                           @SC86295 06087000
  1443. DSKOP0   BAL   2,DSKLKP      Get FST, ADT ptrs                 @SC86295 06088000
  1444.          BNZ   DSKER1        Not found                         @SC86295 06089000
  1445.          BAL   14,DSKVALS                                      @SC86295 06090000
  1446.          B     RTRN0                                           @SC86295 06091000
  1447. *                                                                       06092000
  1448. * Open for output file whose name is at (R2), FDB at (R1)               06093000
  1449. DSKOPNO  DS    0H                                              @SC89073 06094000
  1450.          BAL   9,DSKALC      Get FAB                           @SC86295 06095000
  1451.          BAL   2,DSKLKP      Get FST, ADT ptrs                 @SC86295 06095100
  1452.          BNZ   DSKOPLR       Not found, just writing new       @SC87012 06095200
  1453.          TM    FDBFLGS,APPN+SVATT  Should we keep attributes?  @SC90033 06095300
  1454.          BZ    *+8           No                                @SC90033 06095400
  1455.           BAL  14,DSKVALS    Yes, copy old ones to FDB         @SC90033 06095500
  1456.          TM    FDBFLGS,APPN                                    @SC86295 06096000
  1457.          BO    DSKOPLR                                         @SC90033 06097000
  1458.        FSERASE FSCB=(3)                                        @SC86295 06098000
  1459. DSKOPLR  SR    0,0                                             @SC87012 06103000
  1460.          ICM   0,3,FDBLRC    File LRECL                        @SC87012 06104000
  1461.          CLI   FDBRCF,C'V'   RECFM F limited to LRECL          @SC88120 06105000
  1462.          BNE   DSKSTLR                                         @SC88120 06105500
  1463.          CLI   TYPFIL,C'B'   Binary?                           @SC88120 06106000
  1464.          BE    DSKSTLR       Yes, always fold                  @SC88120 06106500
  1465.          L     0,MAXLRC      TEXT file, no limit               @SC87012 06107000
  1466. DSKSTLR  ST    0,FABLRTR     Set effective record length       @SC88120 06108000
  1467.          B     RTRN0                                           @SC86295 06109000
  1468. *                                                                       06110000
  1469. * Test for existence of file whose name is at (R2)                      06111000
  1470. DSKTEST  DS    0H                                              @SC89073 06112000
  1471.          MVC   DSKSTNM,0(2)                                    @SC86295 06113000
  1472.          LA    3,DSKSTT                                        @SC86295 06114000
  1473.          B     DSKOP0        Test file                         @SC86295 06115000
  1474. *                                                                       06116000
  1475. * Close file whose ticket is at (R1), release block                     06117000
  1476. DSKCLOS  DS    0H                                              @SC89073 06118000
  1477.          ICM   3,15,0(1)     Get FAB ptr, if any               @SC86295 06119000
  1478.          BZ    RTRN0         None, ignore                      @SC86295 06120000
  1479.          XC    0(4,1),0(1)   Yes, now clear ticket             @SC86295 06121000
  1480.        FSCLOSE FSCB=(3)                                        @SC86295 06122000
  1481.          LA    0,FABDWDS                                       @SC86295 06123000
  1482.        DMSFRET DWORDS=(0),LOC=(1)                              @SC86295 06124000
  1483.          B     RTRN0                                           @SC86295 06125000
  1484. *                                                                       06126000
  1485. * Point past 1st N records of file at (R1)                     @SC89218 06126500
  1486. DSKPNT   ICM   3,15,0(1)     Get ticket                        @SC89218 06127000
  1487.          BZ    RTRN1         Not open                          @SC89218 06127500
  1488.          LA    6,1                                             @SC89218 06128000
  1489.          AR    6,2           Rec no. = 1 + number to skip      @SC89218 06128500
  1490.          BNP   RTRN0         Never mind                        @SC89218 06129000
  1491.          C     6,FDBNREC     File long enough?                 @SC89218 06129500
  1492.          BH    RTRN1         No, skip it                       @SC89218 06130000
  1493.          SR    0,0           Don't mess with write point       @SC89218 06130500
  1494.          FSPOINT FSCB=(3),WRPNT=(0),RDPNT=(6),FORM=E           @SC89218 06131000
  1495.          B     RTRN          Return with completion code       @SC89218 06131500
  1496. *                                                                       06136000
  1497. * Analyze error: packed dec. code in TMPDW                              06137000
  1498. DSKXXX   DS    0H                                              @SC89073 06138000
  1499.          MVI   ERRNUM,ERRDIE Set Kermit error code             @SC87338 06139000
  1500.          L     2,EMSGP       Ptr to msg buffer                 @SC87338 06140000
  1501.          MVC   0(8,2),0(1)   Copy oprn name                    @SC87338 06141000
  1502.          MVC   8(2,2),=C'R='                                   @SC87338 06142000
  1503.          OI    TMPDW+7,15    Set zone                          @SC87338 06143000
  1504.          UNPK  10(2,2),TMPDW Copy error code                   @SC87338 06144000
  1505.          MVC   EMSGL,F12     Length of string                  @SC87338 06145000
  1506.          B     RTRN1                                           @SC87338 06146000
  1507. *                                                                       06147000
  1508. * Disk utility for file(s) at (R1) and (R2)                             06148000
  1509. DSKUTL   SH    0,=H'13'      Code-13: DIR,DEL,REN,COP          @SC86316 06149000
  1510.          LR    8,0           Save a copy                       @SC86316 06150000
  1511.          SLA   0,3                                             @SC86295 06151000
  1512.          LA    5,DSKCMDS                                       @SC86295 06152000
  1513.          AR    5,0           Ptr to command name               @SC86295 06153000
  1514.          LA    4,CMD         Buffer for tokenized command      @SC86295 06154000
  1515.          MVC   0(8,4),0(5)                                     @SC86295 06155000
  1516.          LA    4,8(4)                                          @SC86295 06156000
  1517.          LR    6,1           1st file                          @SC86295 06157000
  1518.          BAL   3,DSKUTCP                                       @SC86295 06158000
  1519.          SRA   0,4                                             @SC86295 06159000
  1520.          BZ    *+10                                            @SC86295 06160000
  1521.          LR    6,2           2nd file                          @SC86295 06161000
  1522.          BAL   3,DSKUTCP                                       @SC86295 06162000
  1523.          LTR   8,8           Code-13                           @SC86316 06163000
  1524.          BNZ   *+14          Go if not LISTFILE                @SC86316 06163500
  1525.          MVC   0(16,4),=CL16'(       DATE'                     @SC86295 06164000
  1526.          LA    4,16(4)                                         @SC86295 06165000
  1527.          MVI   0(4),X'FF'    Insert fence                      @SC86295 06166000
  1528.          MVC   1(7,4),0(4)                                     @SC86295 06167000
  1529.          LA    0,CMD                                           @SC86295 06168000
  1530.          NI    FL4,255-UCMD  Not user command: already tokens  @SC86295 06169000
  1531.          KCALL SUPFNC,3      Execute it                        @SC86295 06170000
  1532.          B     RTRN                                            @SC86295 06171000
  1533. *                                                                       06172000
  1534. DSKUTCP  LA    7,LFID        Length of name                    @SC86295 06173000
  1535.          ICM   7,8,BLANK     Blank fill                        @SC86295 06174000
  1536.          LA    5,24                                            @SC86295 06175000
  1537.          MVCL  4,6           Copy name and update R4           @SC86295 06176000
  1538.          BR    3                                               @SC86295 06177000
  1539. *                                                                       06178000
  1540. DSKCMDS  DC    C'LISTFILE'   Utility command names             @SC86295 06179000
  1541.          DC    C'ERASE   '                                     @SC86295 06180000
  1542.          DC    C'RENAME  '                                     @SC86295 06181000
  1543.          DC    C'COPYFILE'                                     @SC86295 06182000
  1544. *                                                                       06183000
  1545. * Return on error, release useless block, if any                        06184000
  1546. DSKER1   LTR   1,4           Any block assigned?               @SC86295 06185000
  1547.          BZ    RTRN1         No                                @SC86295 06186000
  1548.          LA    0,FABDWDS     Yes, release it                   @SC86295 06187000
  1549.        DMSFRET DWORDS=(0),LOC=(1)                              @SC86295 06188000
  1550.          B     RTRN1         Flag error                        @SC86295 06189000
  1551. *                                                                       06190000
  1552. DSKALC   LR    5,1           Save FDB ptr                      @SC86295 06191000
  1553.          MVC   DSKSTNM,0(2)                                    @SC86295 06192000
  1554.          LA    0,FABDWDS                                       @SC86295 06193000
  1555.        DMSFREE DWORDS=(0),ERR=DSKER1                           @SC86295 06194000
  1556.          LR    3,1           New block ptr                     @SC86295 06195000
  1557.          LA    4,FDBD        FDB pointer                       @SC88120 06196000
  1558.          RETREG (0,3),(1,4)  Return (3) as R0, (4) as R1       @SC89218 06197000
  1559.          LR    4,3           Indicate we have it               @SC88120 06198500
  1560.          XC    0(8*FABDWDS,3),0(3)                             @SC86295 06199000
  1561.          MVC   FDBD(FDBCOP),0(5) Copy user's FDB               @SC86295 06200000
  1562.          MVC   FABFN(18),0(2)                                  @SC86295 06201000
  1563.          OI    FDBFLGS,FDBEPL                                  @SC86295 06202000
  1564.          MVI   FABANIT+3,1                                     @SC86295 06203000
  1565.          ICM   14,15,LFID(2) Get start and end for sending     @SC89218 06203200
  1566.          ICM   15,15,LFID+4(2)                                 @SC89218 06203400
  1567.          SLR   15,14         Length of request                 @SC89218 06203600
  1568.          ST    15,FDBSREC    Save for length computation       @SC89218 06203800
  1569.          BR    9                                               @SC86295 06204000
  1570. *                                                                       06205000
  1571. DSKLKP  DMSKEY NUCLEUS                                         @SC86295 06206000
  1572.         GETFST DSKSTT        Call system routine for FST       @SC86295 06207000
  1573.          LR    9,0           Save ADT ptr                      @SC86295 06208000
  1574.          LR    8,1           And FST ptr                       @SC86295 06209000
  1575.          LTR   1,15          Save return code                  @SC86295 06210000
  1576.         DMSKEY RESET                                           @SC86295 06211000
  1577.          LTR   15,1          Test return code                  @SC86295 06212000
  1578.          BR    2                                               @SC86295 06213000
  1579. *                                                                       06214000
  1580. * Set up search through list of files, pattern at (R1)                  06215000
  1581. DSKNSET  DS    0H                                              @SC89073 06216000
  1582.          NI    DSKFL,255-CWDF Find files                       @SC86295 06217000
  1583.          MVC   NXFN(18),0(1)                                   @SC86295 06218000
  1584. *                                                                       06218300
  1585. * Flush previous file pattern                                           06218600
  1586. DSKNSX   MVI   ADT,X'80'     Start over                        @SC86295 06219000
  1587.          B     RTRN0                                           @SC86295 06220000
  1588. *                                                                       06225000
  1589. * Check CWD string, return code in R15                                  06226000
  1590. DSKCWDF  DS    0H                                              @SC89073 06227000
  1591.          OI    DSKFL,CWDF    Find disk                         @SC86295 06228000
  1592.          MVC   NXFN(18),0(1)                                   @SC86295 06229000
  1593.          MVI   ADT,X'80'     Start over                        @SC86295 06230000
  1594.          B     NXTFST                                          @SC86295 06231000
  1595. *                                                                       06232000
  1596. * Check disk space for proposed file: FDB at (R1), FAB ptr at (R6)      06233000
  1597. DSKTSP   L     5,FDBSIZE-FDBD(,1)  Get actual size             @SC90037 06233500
  1598.          ICM   3,15,0(6)     Get FAB ptr                       @SC90037 06234000
  1599.          BZ    DSKTSPX       Not open yet                      @SC90037 06234500
  1600.          IC    1,FABFM       Get mode letter                   @SC90037 06235000
  1601. DSKTSP0  DS    0H                                              @SC90037 06235500
  1602.          USING FSTSECT,8                                       @SC90037 06236000
  1603.          USING ADTSECT,9                                       @SC86316 06237000
  1604.          L     9,IADT        Look at 1st ADT                   @SC86316 06238000
  1605. DSKTSP1  CLM   1,1,ADTM      Find right disk                   @SC90037 06239000
  1606.          BE    DSKTSP2                                         @SC86316 06240000
  1607.          ICM   9,15,ADTPTR   Try next                          @SC86316 06241000
  1608.          BNZ   DSKTSP1                                         @SC86316 06242000
  1609.          B     RTRN0         Disk not found!                   @SC86316 06243000
  1610. DSKTSP2  L     1,ADTNUM      Total blocks                      @SC86316 06244000
  1611.          S     1,ADTUSED     Less used                         @SC86316 06245000
  1612.          M     0,ADTDBSIZ    Times block size                  @SC86316 06246000
  1613.          SRDA  0,10          Convert to Kbytes                 @SC86316 06247000
  1614.          CLR   1,5                                             @SC90037 06248000
  1615.          BL    RTRN1         No room                           @SC86316 06249000
  1616.          B     RTRN0         Ok                                @SC86316 06250000
  1617. DSKTSPX  MVC   DSKSTNM,0(2)  File not opened yet, look for it  @SC90037 06250050
  1618.          BAL   2,DSKLKP                                        @SC90037 06250100
  1619.          IC    1,DSKSTNM+FABFM-FABFN Mode letter, in case      @SC90037 06250150
  1620.          BNZ   DSKTSP0       Not found, nothing to erase       @SC90037 06250200
  1621.          TM    ADTFLG4,ADTEDF  Extended format?                @SC90037 06250250
  1622.          BZ    DSKTSOF                                         @SC90037 06250300
  1623.          L     1,ADTDBSIZ    Block size                        @SC90037 06250350
  1624.          M     0,FSTADBC     Number of blocks                  @SC90037 06250400
  1625.          B     DSKTSS                                          @SC90037 06250450
  1626. DSKTSOF  SR    0,0                                             @SC90037 06250500
  1627.          LA    1,800         Block size                        @SC90037 06250550
  1628.          MH    1,FSTDBC                                        @SC90037 06250600
  1629. DSKTSS   SRDA  0,10          Convert to kbytes                 @SC90037 06250650
  1630.          SR    5,1           Assume old file will be erased    @SC90037 06250700
  1631.          BNP   RTRN0         Will release enough for new file  @SC90037 06250750
  1632.          B     DSKTSP2       Not enough, check free blocks     @SC90037 06250800
  1633. *                                                                       06251000
  1634. *        NXTFST Routine - searches the ADT and FST chains               06252000
  1635. DSKNXT   DS    0H                                              @SC89073 06253000
  1636. * Carl Kass and Jeff Damens, CUCCA User Services, 12/80                 06254000
  1637. * Modified for Kermit-CMS by Vace Kundakci, 12/85                       06255000
  1638. * Copyright (C) 1980 Columbia University                                06256000
  1639. * Permission is granted to any individual or institution to copy        06257000
  1640. * or use this program, except for explicitly commercial purposes.       06258000
  1641. *                                                                       06259000
  1642. * NXFN,-FT,-FM contain a CMS fileid, possibly containing wildcard       06260000
  1643. * characters, and FST and ADT contain pointers to a valid ADT & FST     06261000
  1644. * or are null (negative ADT), return the next FST matching the given    06262000
  1645. * filename in FST and the address of the corresponding ADT in ADT.      06263000
  1646. * Also move the matched filename into FN, FT, FM.                       06264000
  1647. * Also return info in a File Descriptor Block                  @SC86151 06265000
  1648. *                                                                       06266000
  1649.          USING DCHSECT,1                                                06268000
  1650. NXTFST   ICM   9,15,ADT      Supplied ADT                               06269000
  1651.          BP    NXFNEXT               Use it if there's one              06270000
  1652.          L     9,IADT        Else, start with first ADT        @SC86295 06271000
  1653.          NI    DSKFL,255-WFM-WFT-WFN   Nothing wild yet                 06272000
  1654.          LA    3,NXFN                                          @SC86295 06273000
  1655.          BAL   14,NXFPAT                                       @SC86295 06274000
  1656.            OI  DSKFL,WFN                                       @SC86295 06275000
  1657.          LA    3,NXFT                                          @SC86295 06276000
  1658.          BAL   14,NXFPAT                                       @SC86295 06277000
  1659.            OI  DSKFL,WFT                                       @SC86295 06278000
  1660.          CLI   NXFM,C'A'                                       @SC86115 06279000
  1661.          BNL   NXFAFM                Go if mode letter is A or more     06280000
  1662.          MVI   NXFM,C'%'     Set to % if it was blank          @SC86115 06281000
  1663.          OI    DSKFL,WFM                                                06282000
  1664. NXFAFM   CLI   NXFM+1,C'0'                                     @SC86115 06283000
  1665.          BNL   NXFADT                Go if mode number is numeric       06284000
  1666.          MVI   NXFM+1,C'%'   Set to % if was blank or *        @SC86115 06285000
  1667. NXFADT   TM    ADTFLG1,ADTFRO+ADTFRW                                    06286000
  1668.          BZ    NXFNADT                                                  06287000
  1669.          CLI   NXFM,C'%'                                       @SC86115 06288000
  1670.          BE    NXFFFST               Go if he can use any               06289000
  1671.          CLC   ADTM,NXFM                                                06290000
  1672.          BE    NXFFFST               Go if it is this disk              06291000
  1673.          TM    DSKFL,CWDF    Called for CWD?                   @SC86295 06292000
  1674.          BO    NXFNADT       Just looking for disk             @SC86222 06293000
  1675.          CLC   ADTMX,NXFM    Check for read-only extension     @SC86222 06294000
  1676.          BE    NXFFFST       Yes, search here too              @SC86222 06295000
  1677. NXFNADT  ICM   9,15,ADTPTR   Use next ADT                      @SC86295 06296000
  1678.          BNZ   NXFADT                But ony if it exists               06297000
  1679. NXFER    MVI   ADT,255               For next time, start all over      06298000
  1680.          B     RTRN1         Bad return code                   @SC86295 06299000
  1681. *                                                                       06300000
  1682. NXFPAT   LA    1,8(3)        End addr of FN or FT              @SC86295 06301000
  1683.          TRT   0(8,3),TRTBL  Look for space                    @SC86295 06302000
  1684.          SR    1,3           Compute length                    @SC86295 06303000
  1685.          ST    1,NXFFNL-NXFN(3) Length of pattern              @SC86295 06304000
  1686.          MVI   TRTBL+C' ',0  Don't want to catch a blank       @SC86115 06305000
  1687.          MVI   TRTBL+C'%',1  Want to catch a percent           @SC86115 06306000
  1688.          MVI   TRTBL+C'*',1  Want to catch an asterisk         @SC86115 06307000
  1689.          TRT   0(8,3),TRTBL  See if any % or * in FN           @SC86295 06308000
  1690.          MVI   TRTBL+C'%',0  Restore TRTBL                     @SC86115 06309000
  1691.          MVI   TRTBL+C'*',0                                    @SC86115 06310000
  1692.          MVI   TRTBL+C' ',1                                    @SC86115 06311000
  1693.          BZ    4(14)         No wild chars found               @SC86295 06312000
  1694.          BR    14                                              @SC86295 06313000
  1695. *                                                                       06314000
  1696. NXFFFST  L     1,ADTFDA              Grab hyperblock ptr                06315000
  1697.          TM    DSKFL,CWDF    Called for CWD?                   @SC86295 06316000
  1698.          BO    NXFHSV        Yes, found it                     @SC86164 06317000
  1699. NXFHYP   ST    1,NXFHYPE             Save for later                     06318000
  1700.          LA    8,DCHDATA             Point to first FST                 06319000
  1701.          L     3,DCHDWSIZ            Get size of hyperblock             06320000
  1702.          SLL   3,3                   Convert to bytes                   06321000
  1703.          LA    2,DCHSECT(3)          Add to get end of hyperblk         06322000
  1704.          ST    2,NXFHEND             Save it                            06323000
  1705. *                                                                       06324000
  1706. * All initialized. Ready to step through files. R8 contains current     06325000
  1707. * FST, R9 contains current ADT, NXFHYPE contains current hyperblock     06326000
  1708. * NXFHEND has end of hyperblock.                                        06327000
  1709. *                                                                       06328000
  1710. NXFFST   CLC   F0,FSTN                                                  06329000
  1711.          BE    NXFNHYP               Go try next hyperblock             06330000
  1712.          CLC   F0,FSTN+4                                                06331000
  1713.          BE    NXFNFST               Go if directory or Alocmap         06332000
  1714.          LA    4,NXFN                                          @SC86295 06333000
  1715.          LA    5,FSTN                                          @SC86295 06334000
  1716.          TM    DSKFL,WFN                                       @SC86295 06335000
  1717.          BAL   14,NXFCOMP    Test pattern against token        @SC86295 06336000
  1718.          LA    4,NXFT                                          @SC86295 06337000
  1719.          LA    5,FSTT                                          @SC86295 06338000
  1720.          TM    DSKFL,WFT                                       @SC86295 06339000
  1721.          BAL   14,NXFCOMP    Test pattern against token        @SC86295 06340000
  1722. *                                                                       06341000
  1723.          CLI   NXFM+1,C'%'                                     @SC86115 06342000
  1724.          BE    NXFHAVE               Go if any FM is ok                 06343000
  1725.          CLC   NXFM+1(1),FSTM+1                                @SC86295 06344000
  1726.          BNE   NXFNFST               Go if no match                     06345000
  1727. NXFHAVE  MVC   FN,FSTN       Return FN                         @SC86164 06346000
  1728.          MVC   FT,FSTT               Return FT                          06347000
  1729.          MVC   FM+1(1),FSTM+1        Return FM number                   06348000
  1730.          LA    3,DSKSTT                                        @SC86295 06349000
  1731.          MVC   FDBSREC,F0    Length request not known          @SC89218 06349500
  1732.          BAL   14,DSKVALS    Copy out quantities               @SC86295 06350000
  1733. NXFHSV   MVC   FM(1),ADTM    Return FM letter                  @SC86164 06351000
  1734.          ST    9,ADT         Save ADT for him                  @SC86295 06352000
  1735.          ST    8,FST         Ditto for FST                     @SC86164 06353000
  1736.          B     RTRN0                                           @SC86295 06354000
  1737. *                                                                       06355000
  1738. * Come to NXFNFST to step to next file.                                 06356000
  1739. *                                                                       06357000
  1740. NXFNEXT  L     8,FST                                                    06358000
  1741. NXFNFST  TM    ADTFLG4,ADTEDF                                           06359000
  1742.          BZ    NXFNEDF               Go if not EDF                      06360000
  1743.          LA    8,FSTL2(8)            Point to next EDF FST              06361000
  1744.          B     NXFEDF                                                   06362000
  1745. *                                                                       06363000
  1746. NXFNEDF  LA    8,FSTL(8)             Point to next non-EDF FST          06364000
  1747. NXFEDF   C     8,NXFHEND             End of hyperblock?                 06365000
  1748.          BL    NXFFST                No, there are more FSTs still      06366000
  1749. NXFNHYP  L     1,NXFHYPE             Point to current hyperblock        06367000
  1750.          ICM   1,B'1111',DCHFWPTR    Next hyperblock                    06368000
  1751.          BNZ   NXFHYP                Go use next hyperblock if any      06369000
  1752.          B     NXFNADT               Need to use next disk              06370000
  1753. *                                                                       06371000
  1754. DSKVALS  LA    0,FDBD        Ptr to FDB                        @SC86295 06372000
  1755.          RETREG (1,0)        Return (0) as R1 to caller        @SC89218 06373000
  1756.          NI    DSKFL,255-WARB                                  @SC86295 06375000
  1757.          TM    ADTFLG4,ADTEDF  Extended format?                @SC86149 06376000
  1758.          BZ    DSKVNEF                                         @SC86149 06377000
  1759.          L     1,ADTDBSIZ    Block size                        @SC86149 06378000
  1760.          M     0,FSTADBC     Number of blocks                  @SC86149 06379000
  1761.          L     7,FSTAIC      Get item count                    @SC86239 06380000
  1762.          MVC   FDBDATE+1(6),FSTADATI Copy file date/time       @SC88235 06381000
  1763.          B     DSKVEF                                          @SC86149 06382000
  1764. DSKVNEF  SR    0,0                                             @SC86149 06383000
  1765.          LA    1,800         Block size                        @SC86149 06384000
  1766.          MH    1,FSTDBC                                        @SC86149 06385000
  1767.          LH    7,FSTIC       Get item count                    @SC86239 06386000
  1768.          PACK  FDBDATE+1(2),FSTYR(3) Copy file year            @SC86295 06387000
  1769.          MVC   FDBDATE+2(4),FSTD     Copy file date/time       @SC88235 06388000
  1770. DSKVEF   SRDA  0,10          Convert to kbytes                 @SC86149 06389000
  1771.          ST    7,FDBNREC     Save number of records            @SC89218 06389100
  1772.          ICM   6,15,FDBSREC  Length requested to send          @SC89218 06389200
  1773.          BZ    DSKVFLN       Not known                         @SC89218 06389300
  1774.          CLR   7,6           Use min                           @SC89218 06389400
  1775.          BNH   *+6                                             @SC89218 06389500
  1776.           LR   7,6                                             @SC89218 06389600
  1777. DSKVFLN  DS    0H                                              @SC89218 06389700
  1778.          M     6,FSTIL       Compute byte count (approx. if V) @SC86239 06390000
  1779.          AL    7,=F'1023'    Round up                          @SC87007 06391000
  1780.          BC    12,*+8        No overflow                       @SC88092 06392000
  1781.          LA    6,1(6)                                          @SC86239 06393000
  1782.          SRDA  6,10                                            @SC86239 06394000
  1783.          CLR   1,7           Compare with official length      @SC86239 06395000
  1784.          BL    *+6                                             @SC86239 06396000
  1785.          LR    1,7           Use computed length instead       @SC86239 06397000
  1786.          LTR   1,1                                             @SC86239 06398000
  1787.          BNZ   *+8                                             @SC86239 06399000
  1788.          LA    1,1           Never say zero length             @SC86239 06400000
  1789.          ST    1,FDBSIZE     File size                         @SC86295 06401000
  1790.          MVI   FDBDATE,X'19' Assume 20th Cent                  @SC86295 06402000
  1791.          CLI   FDBDATE+1,X'50'                                 @SC86295 06403000
  1792.          BH    *+8           Ok                                @SC86295 06404000
  1793.          MVI   FDBDATE,X'20' Must be 21st                      @SC86295 06405000
  1794.          MVC   FDBRCF,FSTFV  Copy format                       @SC86295 06406000
  1795.          MVC   FDBLRC,FSTIL+2 No, copy from FST                @SC86295 06407000
  1796.          LR    7,14                                            @SC86295 06408000
  1797.          SR    0,0           Search from start                 @SC86295 06409000
  1798.          LR    1,3           Filename in FAB                   @SC86295 06410000
  1799.          A     13,F8         Preserve chain ptr in save area   @SC86295 06411000
  1800.          L     15,AACTLKP    Find if active file               @SC86295 06412000
  1801.          BALR  14,15                                           @SC86295 06413000
  1802.          S     13,F8         Resume ptr to save area           @SC86295 06414000
  1803.          LTR   15,15         Is it active?                     @SC86295 06415000
  1804.          BNZR  7                                               @SC86295 06416000
  1805.          OI    FDBFLGS,FDBACTV Yes                             @SC86295 06417000
  1806.          BR    7                                               @SC86295 06418000
  1807. *                                                                       06423000
  1808.          DROP  1,8,9                                           @SC86295 06424000
  1809. *                                                                       06425000
  1810. NXFCOMP  MVC   NXFSTR,0(5)   Copy name in                      @SC86295 06426000
  1811.          BO    NXFWF         Go if wild FN or FT               @SC86295 06427000
  1812.          CLC   NXFSTR,0(4)                                     @SC86295 06428000
  1813.          BNE   NXFNFST       Go if no match                    @SC86295 06429000
  1814.          BR    14                                              @SC86295 06430000
  1815. *                                                                       06431000
  1816. NXFWF    LA    1,8(5)        Assume end                        @SC86295 06432000
  1817.          TRT   0(8,5),TRTBL  Look for first non-space          @SC86295 06433000
  1818.          SR    1,5           Compute length                    @SC86295 06434000
  1819.          LR    7,1           Save length                       @SC86295 06435000
  1820.          L     5,NXFFNL-NXFN(4)                                @SC86295 06436000
  1821.          LA    6,NXFSTR                                        @SC86295 06437000
  1822. *                                                                       06438000
  1823. * Enter here with R4-R7 containing:                                     06439000
  1824. *    pattern address and length                                         06440000
  1825. *    source address and length                                          06441000
  1826. *                                                                       06442000
  1827.          NI    DSKFL,255-WARB Haven't seen any of these        @SC86295 06443000
  1828.          ICM   7,B'1000',ASTER       Use * as the fill char             06444000
  1829. WLDLOOP  CLCL  4,6                   Compare them                       06445000
  1830.          BER   14            They're equal, fine               @SC86295 06446000
  1831. *                                                                       06447000
  1832. * String mismatch - so examine offending pattern character.  If not     06448000
  1833. * % or * and we haven't seen any * yet, we fail.  If it's % we just     06449000
  1834. * skip it; if it's * we skip it and remember we've seen it.  Else       06450000
  1835. * back up to one past the last * and try again.                         06451000
  1836. *                                                                       06452000
  1837.          CLI   0(4),C'%'                                       @SC86115 06453000
  1838.          BE    WLDLEN1               Go if % = LEN(1) pattern           06454000
  1839.          CLI   0(4),C'*'                                       @SC86115 06455000
  1840.          BE    WLDARB                Go if * = ARB pattern              06456000
  1841.          TM    DSKFL,WARB                                      @SC86295 06457000
  1842.          BZ    NXFNFST       Go if ARB already seen            @SC86295 06458000
  1843.          CLM   7,B'0111',F0          More data to compare?              06459000
  1844.          BE    NXFNFST       Go if exhausted                   @SC86295 06460000
  1845.          LM    4,7,WLDPAT            Restore addr of old ARB char       06461000
  1846.          LA    6,1(6)                Push one past                      06462000
  1847.          BCTR  7,0                   Decrement length                   06463000
  1848.          STM   6,7,WLDSRC            Store changed addr                 06464000
  1849.          B     WLDLOOP               And go compare again.              06465000
  1850. *                                                                       06466000
  1851. WLDLEN1  LA    4,1(4)                Increment pattern addr             06467000
  1852.          BCTR  5,0                   Decrement pattern len              06468000
  1853.          CLM   7,7,F0        Length to compare more            @SC86119 06469000
  1854.          BE    NXFNFST       None, pattern '%' is extra        @SC86119 06470000
  1855.          LA    6,1(6)                Increment source addr              06471000
  1856.          BCTR  7,0                   Decrement source len               06472000
  1857.          CLM   7,7,F0        Length to compare more            @SC86119 06473000
  1858.          BNE   WLDLOOP               Go if more data                    06474000
  1859.          LTR   5,5                   Anything more in pattern?          06475000
  1860.          BZR   14            No, it's a match                  @SC86295 06476000
  1861.          CLI   0(4),C'*'                                       @SC86115 06477000
  1862.          BE    WLDLOOP               Go if ARB                          06478000
  1863.          B     NXFNFST       Failed                            @SC86295 06479000
  1864. *                                                                       06480000
  1865. * If pattern ends in ARB, then it will match anything.  So return to    06481000
  1866. * caller if the pattern is exhausted.                                   06482000
  1867. *                                                                       06483000
  1868. WLDARB   OI    DSKFL,WARB    Remember we saw one               @SC86295 06484000
  1869.          LA    4,1(4)                Pass the ARB                       06485000
  1870.          BCTR  5,0                   Decrement its length               06486000
  1871.          LTR   5,5                   Any more left?                     06487000
  1872.          BZR   14            No, it's a match                  @SC86295 06488000
  1873.          STM   4,7,WLDPAT            Save where they were               06489000
  1874.          B     WLDLOOP                                                  06490000
  1875. *                                                                       06491000
  1876.          LOCALS ,                                              @SC86295 06492000
  1877. WLDPAT   DS    A                     Place in pattern of last ARB       06493000
  1878.          DS    F                     Length of pattern past ARB         06494000
  1879. WLDSRC   DS    A                     Place in source when ARB seen      06495000
  1880.          DS    F                     Length of source past WLDSRC       06496000
  1881. *                                                                       06497000
  1882. WILD     EXIT                                                           06498000
  1883.